1> today a friend asked a question:
There is no error in reading pictures, documents, and other file paths with the file control, but when reading a video file (such as RMVB, etc.), the page cannot display an error. The code snippet is as follows:
private void Btnupfiles_click (object sender, System.EventArgs e)
{
String Pathname=this. File1.PostedFile.FileName.ToString ();
Response.Write (PathName);
}
2> to solve the problem:
I thought it was the problem of taking the path string, so I intercepted the path and file name, then intercepted the file's suffix name, and saved it as a string, but there was always a mistake. The code snippet is as follows:
String Fullname=this. File1.PostedFile.FileName.ToString ()//Take full path
String Firstname=fullname. Substring (0,fullname. LastIndexOf (".") +1)//Take the path and file name, remove the file suffix name
session["FirstName"]=firstname;//saved in a session
Char [] spliter={'. '};/ /delimiter to split string
string [] filename=this. File1.PostedFile.FileName.Split (spliter);//To save each part of the full path partition in an array
session["LastName"]=filename[filename.length-1];//saves the last element in the array (that is, the suffix name) as a session
Response.Redirect ("test.aspx");//I want to upload this page test. The above method still fails, and the reason for the error seems to be irrelevant to the string.
3> netizen "@@" hint is httpruntime question (thank him):
Problem Resolution: Add the following code to the <system.web></system.web> in Web.config:
Minlocalrequestfreethreads= "4" apprequestqueuelimit= "enableversionheader=" "true"/>
4> from MSDN Explanation:
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 indicate 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.