Add system.IO namespace
then write the following code
Create a text file named as "MyText.txt" in a location where the user having write access.( on which credential you are running the application.)
FileStream fs = new FileStream("D:\\MyText.txt", FileMode.Append, FileAccess.Write);
StreamWriter sw = new StreamWriter(fs);
sw.WriteLine("Exception ="+" "+ex.Message);
sw.Close();
fs.Close();
then write the following code
Create a text file named as "MyText.txt" in a location where the user having write access.( on which credential you are running the application.)
FileStream fs = new FileStream("D:\\MyText.txt", FileMode.Append, FileAccess.Write);
StreamWriter sw = new StreamWriter(fs);
sw.WriteLine("Exception ="+" "+ex.Message);
sw.Close();
fs.Close();
No comments:
Post a Comment