.html data file inside an asp.net page?

J

jobs at webdos

I have a bunch of html pages and a database table with links to them.

I want to dynamically display those pages inside a set location on an
exsisting asp.net 2.0 page when a link is selected, but I don't want to
change the html pages which will contain a duplicate set of <html>
tags.

What's the best way to implement this? WebParts? Does anybody have any
simple example?
 
G

Guest

Howdy,

If i got you right, html content is stored in database (each entry is a
complete html page - <html>...</html>). now, you want to display entries in
one page without affecting page's look and feel (as content consists of
<html>...</html>),. there are two choices
1. <iframe src="htmlGenerator.aspx?contentID=1">
use iframe that points to the aspx page that generates html from database
(remove automatically generated html and use
Reposnse.Write(htmlContentFromdataBase in code behind)) - adventage, you make
sure content is treated as separate page
2. render html content directly to div or any other placeholder i.e.
<div runat="server" id="content1">
code behind: content1.InnerHtml = htmlfromDatabase
However, most of the browsers know taht content containing <html></html>
should be treated specially, (automatically removing
<html><head></head><body></body></html> if applicable or wrapping content
into iframe)

I hope this helps
 
J

jobs

sorry, the html is in a seperate file, what's in the database is the
location of that file. How would I do that?
 
G

Guest

Hi Jobs,

private string LoadHtmlFromFile(string path)
{
using (System.IO.StreamReader reader = System.IO.File.OpenText(path))
{
return reader.ReadToEnd();
}
}

Further to my previous post, above function returns content of the text file.

hope this helps
 

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,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top