Live Chat Icon For mobile
Live Chat Icon

How to read a html file in ASP.NET

Platform: ASP.NET| Category: Files

Use namespace System.IO

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())
End If
input += '</pre>'
Me.Label1.Text = input


string file = Server.MapPath ('temp.html');
StreamReader sr;
FileInfo fi = new FileInfo(file);
string input = '<pre>';
	sr = File.OpenText(file);
	input += Server.HtmlEncode(sr.ReadToEnd());
input += '</pre>';
this.Label1.Text = input;

Share with

Share on twitter
Share on facebook
Share on linkedin

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.