Last post Mar 26, 2013 01:36 AM by JaisonJoe
Apr 13, 2008 11:12 AM|joellevi|LINK
I was wondering if there was a way to write code for a button on a webpage to save the page (dynamic aspx) as a htm page and maybe giving the saved htm page a custom name.
I am working in VB VS2005
Apr 13, 2008 01:26 PM|mbanavige|LINK
Here's an article about emailing an aspx page. the technique used her to capture the generated markup should work for you as well and then instead of emailing it, you could save it to disk.
Apr 13, 2008 07:05 PM|joellevi|LINK
Thanks Mike for your answer, this article was very helpfull in terms of understanding how to render a control in ASP.Net.
The things I still am not sure is how to save the rendered markup as a .htm page?
Apr 13, 2008 07:06 PM|joellevi|LINK
Do I use the System.IO.FileStream method?
Apr 13, 2008 07:14 PM|joellevi|LINK
I guess the File.Create would be a better option? What do you suggest?
Apr 13, 2008 07:51 PM|mbanavige|LINK
File.Create is just a wrapper around a FileStream so use whichever one you're comfortable with. Here's another short article where the author was grabbing some output and then writing it to disk. You should be able to incorporate the code he used the write
to a file.
Apr 13, 2008 10:45 PM|joellevi|LINK
Thnks Mike, thats work perfectly..
next question is what isthe best way to also save the file as .rtf for word.
Apr 13, 2008 11:07 PM|mbanavige|LINK
for turning your html into rtf, you'll need a convertor. If you google a bit, you should find a number of 3rd party convertors. I havent used any of them so i cant specifically recommend anything.
Mar 26, 2013 01:36 AM|JaisonJoe|LINK
Just this two line is enough to save webpage as htm.
Dim webClient As New System.Net.WebClient