Page_Error事件不起作用 [英] Page_Error event not working

查看:112
本文介绍了Page_Error事件不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好朋友,

我必须在上传时验证文件大小.
我在web.config中设置了maxRequestLength="102400"(文件大小最大为100 mb)
当用户附加文件大小超过100mb的文件时,应用程序将调用Page_Error事件.

Hello friends,

I have to validate filesize while uploading.
i set the maxRequestLength="102400" (for filesize upto 100 mb) in web.config
when user attach the file having file size more than 100mb, then application call the Page_Error event.

protected void Page_Error(object sender, EventArgs e)
{
   Response.Redirect("ErrorPage.aspx");
}



但是应用程序不重定向ot"ErrorPage.aspx",它显示现有(upload.aspx)页面,错误消息为"Internet Explorer无法显示该网页"

即使我在page指令中设置了 ErrorPage 属性.

我应该怎么办?
有帮助吗?
在此先感谢.



but application does not redirect ot "ErrorPage.aspx" it displays existing (upload.aspx) page with error message is "Internet Explorer cannot display the webpage"

even i set the ErrorPage property in page directive.

What should i do?
any help?
thanks in advance.

推荐答案



您也可以直接在web.config中设置此错误页面

有关更多信息,请检查此链接

http://www.asp.net/hosting/tutorials/displaying-a- custom-error-page-cs

希望对您也有帮助


最好的
Hi,

you can set this error page directly in web.config also

for more info check this link

http://www.asp.net/hosting/tutorials/displaying-a-custom-error-page-cs

I hope it helps you also


All the Best


嘿哥们,
您可以尝试使用Server.Transfer("ErrorPage.aspx")

祝您好运
Hey Buddy,
You can try by using Server.Transfer("ErrorPage.aspx")

Best of Luck


从您的Web配置页面将自定义错误"设置为开".
无需处理Page_Error事件
Set Custom error to On from your web config page.
No need to go with Page_Error Event


这篇关于Page_Error事件不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆