Start New Discussion within our Web Development Community
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)

        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 = File.AppendText(Filename);
            File.AppendAllText(Filename, Textbox.Text);

        NewName.Text = "Text is saved";

getting error "URI formats are not supported"

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'

This question has already been answered. Start a new discussion instead.