我的情况是,当我上传大小超过4mb的文件时,我想向用户显示一条友好的消息,但是当我超过这个限制时,它不会给我一个错误,而是它带我去:
Internet Explorer cannot display the webpage
我正在做的检查文件大小是这样的:
if (FU_EnglishFile.PostedFile.ContentLength > int.Parse(ConfigurationManager.AppSettings["MaxUploadSize"]))
{
lbl_InvalidFileMsg.Visible = true;
return;
}
else
{
lbl_InvalidFileMsg.Visible = false;
}
我在web配置中的文件大小为:
<add key="MaxUploadSize" value="4194304" />
是否应该在网络配置中设置任何配置或任何帮助将是一个赞赏的
答案 0 :(得分:1)
请使用上面的代码以减小3MB的大小,然后检查结果。
答案 1 :(得分:0)
我找到了问题的答案:
请在网络配置中设置此标记
<system.web>
<httpRuntime executionTimeout="240" maxRequestLength="20480" />
</system.web>
谢谢