1. Map The Server Path
string strFileName = Server.MapPath("partnership_msg.txt");
2. Here is the code to Read Text File From Path "partnership_msg.txt" into streamReader
StreamReader sr = new StreamReader(new FileStream(strFileName,FileMode.Open, FileAccess.Read));
3. Read the content from the StreamReader into string variable
strBody = sr.ReadToEnd();
4. Close the Streamreader
sr.Close();
string strFileName = Server.MapPath("partnership_msg.txt");
2. Here is the code to Read Text File From Path "partnership_msg.txt" into streamReader
StreamReader sr = new StreamReader(new FileStream(strFileName,FileMode.Open, FileAccess.Read));
3. Read the content from the StreamReader into string variable
strBody = sr.ReadToEnd();
4. Close the Streamreader
sr.Close();
No comments:
Post a Comment