In the email sending system or some other websites that transfer files, the size of the files transferred by users is limited, because this not only saves the server space, but also improves the speed of file transfer. The following describes how to configure the size and time limit of the uploaded files in the Web. Config file.
When you configure a string that limits the size and time of the uploaded file in the Web. Config file, it is completed in the MaxRequestLength attribute: Used to prevent server attacks. For example, Access denied due to large files being sent to the server. The default value is 4096 (4 MB)
ExecutionTimeout attribute: specifies the maximum number of seconds allowed to execute a request before the ASP. NET application is automatically closed. This timeout attribute applies only when the debugging attribute in the compilation element is False. The default value is 110 s.
Add the following code to <system. web> </system. web> in web. config::
<! --
Used to support uploading large files. The default size is 4 MB, and the current size is 400 mb.
HttpRuntime is used to configure the asp.net http runtime settings to determine how to process requests to the asp.net application.
ExecutionTimeout: maximum time limit allowed for request execution, in seconds
MaxRequestLength: indicates the maximum file upload size supported by ASP. NET. This restriction can be used to prevent DoS attacks caused by a large number of files being transferred to the server. The specified size is in KB. The default value is 4096 KB (4 MB ).
UseFullyQualifiedRedirectUrl: indicates whether the client redirection is fully qualified (in the "http: // server/path" format, which is required by some mobile controls ), or indicates whether to send relative redirection to the client. If it is True, all non-fully-qualified redirects are automatically converted to a fully-qualified format. False is the default option.
MinFreeThreads: specifies the minimum number of free threads allowed to execute new requests. ASP. NET allows a specified number of threads to remain free by appending threads to complete the requests it processes. The default value is 8.
MinLocalRequestFreeThreads: the minimum number of free threads allowed to execute new local requests maintained by ASP. NET. The number of threads is reserved for requests passed in from the local host to prevent some requests from sending subrequests to the local host during processing. This avoids possible deadlocks caused by recursive re-entering the Web server.
AppRequestQueueLimit: indicates the maximum number of requests that ASP. NET will queue for the application. Requests are queued when there are not enough free threads to process requests. When the queue exceeds the limit specified in this setting, the incoming request is rejected through the "503-the server is too busy" error message.
EnableVersionHeader: Specifies whether ASP. NET should output the version header. Microsoft Visual Studio 2005 uses this attribute to determine the current ASP. NET version. This attribute is not required for the production environment and can be disabled.
-->
Copy codeThe Code is as follows:
<HttpRuntime executionTimeout = "500" maxRequestLength = "409600" timeout = "false" minFreeThreads = "8" minLocalRequestFreeThreads = "4" appRequestQueueLimit = "100"/>