Best way to embed html file in ASP.NET 2.0?

  • Thread starter forumnewbie2006
  • Start date
F

forumnewbie2006

Hello,

How would you recommend embedding an html file in an ASP.NET 2.0 page?


Essentially, I'm looking for the simplest & most light weight way to
embed the content of an html file (from the file system) inside an
ASP.NET 2.0 page. I cannot simply cut & paste the content of the html
file into the .aspx page at design time because the html files are
regularly uploaded onto the file system and their contents change over
time. There are also multiple html files on the file system and the
exact file to embed is not known until run time.

Web Parts can probably solve the problem but it seems like an overkill
for simply embedding a dynamic html file.

Thanks in advance,
joyce
 
M

Mark Newmister

Something like this:

System.IO.TextWriter tw = new System.IO.StringWriter();
this.Server.Execute("Somepage.html",tw);
this.Literal1.Text = tw.ToString();
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top