First You have to check whether file exists or not …if yes then just map the path & write string into file using streamwriter… if (File.Exists(Server.MapPath("logfile.txt"))) { FileStream aFile = new FileStream(Server.MapPath("logfile.txt"),FileMode.Append,FileAccess.Write); StreamWriter sw = new StreamWriter(aFile); sw.WriteLine("test to...