我将maxAllowedContentLength更改为
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="5024000000" />
</requestFiltering>
</security>
Run Code Online (Sandbox Code Playgroud)
在我的web.config中,但在IIS7上运行时出现此错误:
'maxAllowedContentLength'属性无效.不是有效的无符号整数

但是当我在VS服务器中运行时,它正常运行而没有任何错误.
如何配置我的网站允许上传500MB大小的文件,在IIS7上没有这个问题?
我想将文件大小上传限制为某个限制.但是,这里的问题是我想在超过上传大小时提供弹出警报.但是,此处的网页显示以下错误
HTTP Error 404.13 - Not Found
Run Code Online (Sandbox Code Playgroud)
The request filtering module is configured to deny a request that exceeds the request content length.
这是我的代码
protected void Button1_Click(object sender, EventArgs e)
{
if (fuDocpath.HasFiles)
{
try
{
DateTime now = DateTime.Now;
lbldateStamp.Text = now.ToString("mm_dd_yyyy_hh_mm_ss");
//string foldername = lblsessionID.Text + "_" + lbldateStamp.Text;
string folderpath = (Server.MapPath("~/Uploaded_Files/") + lblsessionID.Text + "_" + lbldateStamp.Text + "/");
Directory.CreateDirectory(folderpath);
if (fuDocpath.PostedFile.ContentLength < 20970000)
{
try
{
foreach (HttpPostedFile files in fuDocpath.PostedFiles)
{
string filename = …Run Code Online (Sandbox Code Playgroud)