简体   繁体   English

从 Global.asax 调用 javascript function 没有重定向

[英]Call javascript function from Global.asax without redirect

When in my application occurs an exception (unhandled), i want to stay on the same web page and show an alert.当我的应用程序发生异常(未处理)时,我想留在同一个 web 页面上并显示警报。 Is it possible?可能吗? Example: in page X is raised an uncaught exception, the control flow reaches the global.asax where it is handled by the Application_Error method.示例:在页面 X 中引发未捕获的异常,控制流到达 global.asax 并由 Application_Error 方法处理。 I don't want the global.asax to performe a Response.Redirect but I want to remain in page X and show a javascript alert.我不希望 global.asax 执行 Response.Redirect 但我想保留在第 X 页并显示 javascript 警报。

Thanks谢谢

If you don't want to do Response.Redirect, try Server.Transfer.如果您不想执行 Response.Redirect,请尝试 Server.Transfer。 Server.Transfer Vs. Server.Transfer 对比Response.Redirect 响应.重定向

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM