本文介绍了使用方法“发送文件" )(VS2010 – C#)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨 要下载文件,请使用以下代码:
Hi For download a file I use below code:
if (HttpContext.Current.User.Identity.IsAuthenticated) { String FilePath = @"~\myfolder\myfile.pdf"; HttpContext context = HttpContext.Current; context.Response.AppendHeader("content-disposition", "attachment; filename= myfile.pdf"); context.Response.ContentType = "application/ZipFile"; context.Response.TransmitFile(FilePath); } else { }但是执行此操作后,下面的代码(重定向到另一个页面"的按钮)将无法运行.为什么?
But after do it , below code (a button for Redirect to another page) don’t operate. Why?
try { Response.Redirect("~/myfolder/mypage2.aspx?returnUrl= mypage1.aspx"); } catch { }非常感谢
Thanks very much
推荐答案试试这个 Hi , Try this one try { Response.Redirect("~/myfolder/mypage2.aspx?returnUrl= mypage1.aspx",false); }
最好的问候 米特瓦里(M.Mitwalli)
Best Regards M.Mitwalli
更多推荐
使用方法“发送文件" )(VS2010 – C#)
发布评论