To access to the root folder in website : Server.MapPath("~/") This sample demonstrates to create or to open a file in the root folder of website, then writes test text into it. using System; using System.IO; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { string root = Server.MapPath("~/"); string path = root + "testselim.txt"; using (FileStream fs = new FileStream(path, FileMode.OpenOrCreate)) { using (StreamWriter sw = new StreamWriter(fs)) { sw.WriteLine("Test Text"); sw.Close(); ...
Personal weblog of Selim Özbudak