<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>'save .aspx page as .html file' Thread RSS Feed</title>
    <link>http://www.programmersheaven.com/</link>
    <description>Contains the latest posts from the thread 'save .aspx page as .html file' posted on the 'ASP.NET' forum at Programmer's Heaven.</description>
    <language>en</language>
    <copyright>Copyright 2012 Programmers Heaven</copyright>
    <pubDate>Wed, 23 May 2012 00:28:15 -0700</pubDate>
    <lastBuildDate>Wed, 23 May 2012 00:28:15 -0700</lastBuildDate>
    <generator>Argotic Syndication Framework 2007.3.0.1, http://www.codeplex.com/Argotic</generator>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <ttl>360</ttl>
    <image>
      <url>http://www.programmersheaven.com/images/ph.gif</url>
      <title>Programmers Heaven</title>
      <link>http://www.programmersheaven.com/</link>
      <width>88</width>
      <height>31</height>
    </image>
    <item>
      <title>save .aspx page as .html file</title>
      <link>http://www.programmersheaven.com/mb/ASPNET/408979/408979/save-aspx-page-as-html-file/</link>
      <description>i have looked and looked for this and so far all the code i've downloaded simply doesnt work.&lt;br /&gt;
this code (below) works fine - however it opens up the "save file Dialog" and  requires that the user select the path to save the .html file.&lt;br /&gt;
how can i by-pass that and save the file myself to say - a virtual directory?&lt;br /&gt;
any help is greatly appreciated&lt;br /&gt;
thanks&lt;br /&gt;
rik&lt;br /&gt;
&lt;br /&gt;
Response.Clear()&lt;br /&gt;
            Response.Buffer = True&lt;br /&gt;
            Response.ContentType = "application/html"&lt;br /&gt;
            Response.ContentEncoding = System.Text.Encoding.UTF8&lt;br /&gt;
            Response.AddHeader("Content-Disposition", "attachment;filename=Test.html")&lt;br /&gt;
            Response.Charset = ""&lt;br /&gt;
            EnableViewState = False&lt;br /&gt;
            Dim oStringWriter As System.IO.StringWriter = New System.IO.StringWriter&lt;br /&gt;
            Dim oHtmlTextWriter As System.Web.UI.HtmlTextWriter = New System.Web.UI.HtmlTextWriter(oStringWriter)&lt;br /&gt;
            pnMyPanel.RenderControl(oHtmlTextWriter)&lt;br /&gt;
            Response.Write(oHtmlTextWriter.ToString())&lt;br /&gt;
            Response.Close()</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/ASPNET/408979/408979/save-aspx-page-as-html-file/</guid>
      <pubDate>Mon, 09 Nov 2009 10:26:18 -0700</pubDate>
      <category>ASP.NET</category>
    </item>
    <item>
      <title>Re: save .aspx page as .html file</title>
      <link>http://www.programmersheaven.com/mb/ASPNET/408979/409381/re-save-aspx-page-as-html-file/#409381</link>
      <description>hi,&lt;br /&gt;
&lt;br /&gt;
i'm trying to do this but i need the definition type of tthe pnMyPanel variable.&lt;br /&gt;
&lt;br /&gt;
thks&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/ASPNET/408979/409381/re-save-aspx-page-as-html-file/#409381</guid>
      <pubDate>Mon, 16 Nov 2009 08:49:59 -0700</pubDate>
      <category>ASP.NET</category>
    </item>
    <item>
      <title>Re: save .aspx page as .html file</title>
      <link>http://www.programmersheaven.com/mb/ASPNET/408979/409385/re-save-aspx-page-as-html-file/#409385</link>
      <description>sorry, it's a aspx .Net control.&lt;br /&gt;
basically,&lt;br /&gt;
&amp;lt;asp:Panel ID="pnMyPanel"  Width="800" BorderColor="Black" BorderWidth="3px" runat="server"&amp;gt;&lt;br /&gt;
&lt;br /&gt;
thanks &lt;br /&gt;
rik</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/ASPNET/408979/409385/re-save-aspx-page-as-html-file/#409385</guid>
      <pubDate>Mon, 16 Nov 2009 09:54:03 -0700</pubDate>
      <category>ASP.NET</category>
    </item>
    <item>
      <title>Re: save .aspx page as .html file</title>
      <link>http://www.programmersheaven.com/mb/ASPNET/408979/410253/re-save-aspx-page-as-html-file/#410253</link>
      <description>i went another way with this basically assembling the .aspx page thru string builder. then passing it to &lt;br /&gt;
the IO StreamWriter Object. Not Elegant but it does work.&lt;br /&gt;
thought i would post this as a follow up.&lt;br /&gt;
thanks again&lt;br /&gt;
rik&lt;br /&gt;
  Private Sub WriteHtmlFile(ByVal myPage As String, ByVal myFileName As String)&lt;br /&gt;
&lt;br /&gt;
        Dim myHtmlWriter As System.IO.StreamWriter&lt;br /&gt;
        Dim myFile As String&lt;br /&gt;
        myFile = myFileName.ToString&lt;br /&gt;
        myHtmlWriter = System.IO.File.CreateText("C:\" &amp;amp; myFile &amp;amp; ".html")&lt;br /&gt;
        Dim myFilePath As String = ("C:\" &amp;amp; myFile &amp;amp; ".html")&lt;br /&gt;
        myHtmlWriter.Write(myPage.ToString)&lt;br /&gt;
        myHtmlWriter.Close()&lt;br /&gt;
    End Sub&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/ASPNET/408979/410253/re-save-aspx-page-as-html-file/#410253</guid>
      <pubDate>Thu, 03 Dec 2009 06:51:07 -0700</pubDate>
      <category>ASP.NET</category>
    </item>
  </channel>
</rss>
