tags:

views:

92

answers:

3

Hey all

I am looking for a way to design a simple HTML file, and in runtime - to load it as string to the c#.

I am trying to File.Open it, but it resides in a different location than the binary code.

is there a simple way to tell the build process to load it into a string?

thanks

A: 

If you're using ASP.NET, and the HTML file is relative to your website path:

string html = File.ReadAllText(Server.MapPath("~/virtualPathTo/file.html"));
John Rasch
A: 

If the HTML is on another server, the easiest thing to do is use the HTTPWebRequest class to get the HTML.

jaltiere
A: 

Ok. I used RESOURCES to load a file, and it converted to be a string... :)

thanks all

oshafran