Web.config file configuration restrictions upload file size and Time attribute configuration _ Practical Tips

Source: Internet
Author: User
In the mail delivery system or some other transfer files of the Web site, the user transfer file size is limited, because this will not only save the server space, but also to improve the speed of transfer files. The following describes how to configure the limit upload file size and time in the Web.config file.

When you configure the limit upload file size and time string in the Web.config file, it is done in the maxRequestLength property: Used to prevent server attacks, such as denial of access caused by a user sending a large file to the server. The default value is 4096 (4MB)
Executiontimeout Property: Specifies the maximum number of seconds allowed to execute a request before the ASP.net application shuts down automatically. This timeout property applies only if the Debug property in the compilation element is false. The default value is 110s.

Add the following code to the <system.web></system.web> in Web.config
<!--
For support upload large files, the default support 4M, now modified to 400M
HttpRuntime is to configure the ASP.net HTTP run-time settings to determine how to handle requests for asp.net applications.
Executiontimeout: Represents the maximum time limit, in seconds, that a request is allowed to execute
maxRequestLength: Indicates the maximum file upload size supported by asp.net. This restriction can be used to prevent denial of service attacks caused by a user passing a large number of files to the server. The specified size is in kilobytes. The default value is 4096 KB (4 MB).
useFullyQualifiedRedirectUrl: Indicates whether client redirection is fully qualified (in "Http://server/path" format, which is required for some mobile controls), or whether relative redirection is sent to the client instead. If true, all redirects that are not fully qualified are automatically converted to fully qualified formats. False is the default option.
minFreeThreads: Specifies the minimum number of free threads that are allowed to execute new requests. asp.net the specified number of threads to maintain a free State for requests that require additional threads to complete their processing. The default value is 8.
minLocalRequestFreeThreads: Represents the minimum number of free threads that the ASP.net maintains to allow the execution of new local requests. The number of threads is reserved for requests that are passed in from the local host in case some requests issue a child request to the local host during its processing. This avoids a possible deadlock caused by recursion to re-enter the WEB server.
appRequestQueueLimit: Represents the maximum number of requests that ASP.net will queue for an application. When there are not enough free threads to process the request, the request is queued. When the queue exceeds the limit specified in this setting, the incoming request is rejected through the "503-Server Too busy" error message.
Enableversionheader: Indicates whether the specified asp.net should output a version header. Microsoft Visual Studio 2005 uses this property to determine which version of ASP.net is currently in use. For a production environment, this property is not required and can be disabled.
-->
Copy Code code as follows:

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.