using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using System.Text;
public partial class _Default : Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if(!IsPostBack)

        Textbox.Text = "Enter your Name here";

    }
    protected void Button_Click(object sender, EventArgs e)
    {
        string Filename = "http://localhost:55688/TextFile.txt";
        if (!File.Exists(Filename))
        {
            StreamWriter txtFile = File.CreateText(Filename);
            txtFile.Close();
            txtFile = File.AppendText(Filename);
            txtFile.WriteLine(Textbox.Text);
            txtFile.Close();
        }
        else
            File.AppendAllText(Filename, Textbox.Text);

        NewName.Text = "Text is saved";
        }
    }

getting error "URI formats are not supported"

File doesn't accept URL's. It needs to be an absolute or relative filepath.

i have changed it to

    string Filename = "~/textFile.txt";

and now it is saying
'Could not find a part of the path 'C:\Program Files (x86)\IIS Express\~\textFile.txt'

The ~ is not automatically expanded. You can use MapPath()

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.