I have HTML files placed in an HTML folder of my project. The file name of those HTML files are stored in the field of database. I want to read the contents of each HTML file and put it in a <div> on the web page.
This is what I have done successfully with the image path:
<img width="135px" src="<%:HelperClass.CheckImageUrlExist(HelperClass.Contact.PathProductImages+Model.Item[i].PictureName)%>" alt="<%: Model.Item[i].Name %>"/>
It is no problem with the file name of image, but with the content of html file, I have no idea.
Can anyone tell me, how can I do that? Thanks.
You may use
System.IO.File.ReadAllText()orStreamReaderclass methods to read a file from the disk.For instance, suppose you have
sample.htmlfiles under thefilesfolder in the root web-app folder.