[英]I want the user to be able to download a page
I am using the code, 我正在使用代码,
string loadFile = HttpContext.Current.Request.Url.AbsoluteUri;
// this.Response.ClearContent();
// this.Response.ClearHeaders();
this.Response.AppendHeader("content-disposition", "attachment; filename " + filename);
this.Response.ContentType ="application/html";
this.Response.WriteFile("C:\\Users\\Desktop\\Jobspoint Website\\jobpoint3.0\\print.aspx");
this.Response.Flush();
this.Response.Close();
this.Response.End();
to download an aspx page in asp.net C#.. But its only showing the html tags and static values... How can I save the entire page without html tags and with the values that retrieved from the database? 在asp.net C#中下载aspx页面。但是它只显示html标记和静态值...如何保存整个页面而不包含html标记和从数据库中检索到的值?
Thanks... 谢谢...
Leema 李玛
If I have understood correctly, one option would be to actually make a request to the web server using WebClient for example. 如果我理解正确,那么一种选择是例如使用WebClient实际向Web服务器发出请求。 And then write the response to that request to the Response.OutputStream .
然后将对该请求的响应写入Response.OutputStream 。 This means that the server will actually make a second request to it self and then send the response to the second request back to the client.
这意味着服务器实际上将向自身发出第二个请求,然后将对第二个请求的响应发送回客户端。
This way you will have the web server actually process the request and return the resulting HTML back to you rather than just the raw aspx
page. 这样,您将让Web服务器实际处理请求并将返回的HTML返回给您,而不只是原始的
aspx
页面。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.