Written some cool source code? Upload it to Programmer's Heaven.

ASP.NET

Moderators: None (Apply to moderate this forum)
Number of threads: 1528
Number of posts: 3022

This Forum Only
Post New Thread

Report
save .aspx page as .html file Posted by rikb53 on 9 Nov 2009 at 10:26 AM
i have looked and looked for this and so far all the code i've downloaded simply doesnt work.
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.
how can i by-pass that and save the file myself to say - a virtual directory?
any help is greatly appreciated
thanks
rik

Response.Clear()
Response.Buffer = True
Response.ContentType = "application/html"
Response.ContentEncoding = System.Text.Encoding.UTF8
Response.AddHeader("Content-Disposition", "attachment;filename=Test.html")
Response.Charset = ""
EnableViewState = False
Dim oStringWriter As System.IO.StringWriter = New System.IO.StringWriter
Dim oHtmlTextWriter As System.Web.UI.HtmlTextWriter = New System.Web.UI.HtmlTextWriter(oStringWriter)
pnMyPanel.RenderControl(oHtmlTextWriter)
Response.Write(oHtmlTextWriter.ToString())
Response.Close()
Report
Re: save .aspx page as .html file Posted by Ginapierina on 16 Nov 2009 at 8:49 AM
hi,

i'm trying to do this but i need the definition type of tthe pnMyPanel variable.

thks
Report
Re: save .aspx page as .html file Posted by rikb53 on 16 Nov 2009 at 9:54 AM
sorry, it's a aspx .Net control.
basically,
<asp:Panel ID="pnMyPanel" Width="800" BorderColor="Black" BorderWidth="3px" runat="server">

thanks
rik



 
Popular resources and forums for programmers on Programmersheaven.com
Assembly, Basic, C, C#, C++, Delphi, Java, JavaScript, Pascal, Perl, PHP, Python, Ruby, Visual Basic
© Copyright 2009 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Publisher: Lars Hagelin. Read the latest words from the publisher here.
Be the first to sign up for Lars Hagelin’s In-depth Outsourcing Newsletter here.
bootstrapLabs Logo A bootstrapLabs project.