asp.net的Server.Transfer()异常

编程入门 行业动态 更新时间:2024-10-28 20:18:32
本文介绍了asp的Server.Transfer()异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

为什么我收到异常当执行Server.Transfer的()...

Server.Transfer的(@?〜/学生/ StudentSendMail.aspx用户名=+用户名);{无法评估前pression因为code优化或本机框上调用堆栈的顶部。}

解决方案

这奇怪的错误消息的一个原因是try-catch块内执行Server.Transfer的。有一对夫妇的方式来处理:

1)添加第二个参数设置为false这样的:

Server.Transfer的(@?〜/学生/ StudentSendMail.aspx用户名=+用户名,假的);

2)捕捉类型的异常 System.Threading.ThreadAbortException 键,所以异常被忽略,什么也不做的catch块

3)移动的Server.Transfer到最后块

Why am I getting the exception While executing the Server.Transfer()...

Server.Transfer(@"~/Student/StudentSendMail.aspx?username=" + username); {Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack.}

解决方案

One cause of this strange error message is performing a Server.Transfer inside of a try-catch block. There are a couple of ways to handle that:

1) Add a second argument set to false like this:

Server.Transfer(@"~/Student/StudentSendMail.aspx?username=" + username, false);

2) Catch the Exception of type System.Threading.ThreadAbortException and do nothing in the catch block so the exception is ignored

3) Move the Server.Transfer to the Finally block

更多推荐

asp.net的Server.Transfer()异常

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

发布评论

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

>www.elefans.com

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