使用方法“发送文件" )(VS2010 – C#)

编程入门 行业动态 更新时间:2024-10-11 01:10:05
本文介绍了使用方法“发送文件" )(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#)

本文发布于:2023-11-12 10:14:11,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1581199.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:使用方法   文件   quot

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!