C# | Write HTML from external file

I just wrote this for a friend.
It lets us load html dynamically into our page, that is located in some external file.
Commented lines are for debugging purposes

//Response.Write(Path.GetFullPath(Server.MapPath("1\\teste.txt")));
string filePath = Path.GetFullPath(Server.MapPath("1\\teste.txt"));
string fileContents = File.ReadAllText(filePath);
//Response.Write(fileContents);
this.Controls.Add(new LiteralControl(fileContents));

http://www.csharp411.com/c-read-text-file-into-string/

Comments

Popular posts from this blog

Mobile development opportunities

Breaking down document locking in SharePoint

Working around X-Frame-Options for iframes