Modify the size limit of uploaded files in Web. config.

Source: Internet
Author: User

In the default Asp.net site, Web. config has a certain limit on the size of a single file to be uploaded. The default value is 4096 kb.

We can change the size of a single uploaded file by changing the Web. config file.

The Code is as follows:

<Httpruntime maxrequestlength = "49600" apprequestqueuelimit = "60" executiontimeout = "60"/>

Maxrequestlength indicates the size of a single uploaded file. The value is 40 MB.

You can test the configuration file by yourself. I have tried MB.

**************************************** **************************************** **************************************** *********

The content of the web. config file is roughly as follows:

<Globalization requestencoding = "gb2312" responseencoding = "gb2312"/>

<Sessionstate mode = "inproc" cookieless = "false" timeout = "20"/>

<Httpruntime maxrequestlength = "47185920">

</Httpruntime>

</System. Web>

</Configuration>

Note the location in the file,

Explanation:

<Sessionstate mode = "inproc" cookieless = "false" timeout = "20"/>

// Cookieless = "false", do not use cookies

// Timeout = "20". The session time is 20 minutes. The unit is minutes. You can modify the time here.

<Httpruntime maxrequestlength = "47185920">

// The Maximum File Uploaded By the site by default

**************************************** **************************************** *****************************

Completed in
A. maxrequestlength attribute: Used to prevent service attacks. For example, Access denied due to a large file being sent to the server. The default value is 4096 (4 MB)

.

B. executiontimeout attribute: specifies the maximum number of seconds allowed to execute a request before the ASP. NET application is automatically closed. Only when the compilation element is called

If the value of the trial attribute is false, this attribute applies. The default value is 110 S.

<Httpruntime maxrequestlength = "4096" executiontimeout = "100"/>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.