Use namespace System.IO
VB.NET
Dim file As String = Server.MapPath('temp.html')
Dim sr As StreamReader
Dim fi As New FileInfo(file)
Dim input As String = '<pre>'
If File.Exists(file) Then
sr = File.OpenText(file)
input += Server.HtmlEncode(sr.ReadToEnd())
sr.Close()
End If
input += '</pre>'
Me.Label1.Text = input
C#
string file = Server.MapPath ('temp.html');
StreamReader sr;
FileInfo fi = new FileInfo(file);
string input = '<pre>';
if(File.Exists(file))
{
sr = File.OpenText(file);
input += Server.HtmlEncode(sr.ReadToEnd());
sr.Close();
}
input += '</pre>';
this.Label1.Text = input;
Share with