Type: System.Web.HttpRequest
When the browser requests a page from the server, this behavior is called a request.
The methods and properties of the HttpRequest class are exposed through the request properties of the HttpApplication, HttpContext, page, and UserControl classes.
Common Methods and properties:
Common methods:
MapPath
Request.mappath (): Maps the specified virtual path to a physical path. Parameter: The virtual path (absolute path or relative path) of the current request.
Server.MapPath (): Returns the physical file path corresponding to the specified virtual path on the Web server. Parameter: The virtual path of the Web server.
Return value: The server physical path to which the virtual path is mapped. Note: Just mapping, does not necessarily exist.
Special parameters: The default mapping of the current directory.
Current directory (./) The parameter here is the same as the point and the empty string effect. "E: Solution Project ZZ"
Request.mappath ("./");
Server.MapPath ("./");
Parent directory (.. /) throws an exception if it is already a root. "E: Solution Project"
Request.mappath (".. /");
Server.MapPath (".. /");
Server root (/) "C:inetpubwwwroot"
Request.mappath (".. /");
Server.MapPath (".. /");
Virtual directory root (~/) "E: Solution Project"
Request.mappath ("~/");
Server.MapPath ("~/");
Difference: There is no difference at present, when you meet, you can also give me a message.
Attached: Request.mappath () overloaded method:
Parameters:
VirtualPath: The virtual path (absolute path or relative path) of the current request.
Basevirtualdir: A virtual base directory path for relative resolution.
Allowcrossappmapping:true indicates that virtualpath may belong to another application;
Return: The physical path on the server.
Description: With the second parameter as the relative directory, and then start mapping the first parameter
Attention:
The first argument cannot begin with/or ~/, at which point the second argument is invalid.
The second argument cannot be a relative path, that is, it must start with/or ~/.
If the third argument is false, the second argument must start with ~/.
Example:
Request.mappath ("QQ", "~/zz", false); "E: Solution Project Zzqq"
Request.mappath ("QQ", "/zz", true); "C:inetpubwwwrootzzqq"
Request.mappath ("/qq", "/zz", true); "C:inetpubwwwrootqq" (
ValidateInput
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008, Windows Server 2003, Windows Server Watts SP4, Windows Millennium Edition, Windows 9 8
Common Properties:
Get path and URL
url:http://localhost/asp Tutorial Net/zz/zz.aspx/info?name=wk
To get the physical path:
C #. NET Get path: Details
Obtained by MapPath Mapping: Request.mappath () and Server.MapPath ()
Get through the Request property:
Gets the physical file system path of the root directory of the currently executing server application.
Request.physicalapplicationpath; "E: Solution Project"
Gets the physical file system path that corresponds to the requested URL.
Request.PhysicalPath; "E: Solution Project Zzzz.aspx" gets the virtual path and URL information:
Get the virtual application root path of the ASP.net tutorial application on the server: "/"
Request.applicationpath; "/aspnet"
Gets the virtual path of the application root and makes the path a relative path by using the tilde (~) notation on the application root.
Request.apprelativecurrentexecutionfilepath; "~/zz/zz.aspx"
Gets the virtual path of the current request
Request.currentexecutionfilepath; "/aspnet/zz/zz.aspx"
Request.filepath; "/aspnet/zz/zz.aspx"
Gets the name extension of the filename specified in the Currentexecutionfilepath property.
Request.currentexecutionfilepathextension; ". aspx"
Gets the virtual path of the current request (including attachment path information)
Request.path; "/aspnet/zz/zz.aspx/info"
Gets additional path information for a resource that has a URL extension.
Request.pathinfo; "/info"
Gets information about the URL of the current request.
Request.url; "Http://localhost/aspnet/zz/zz.aspx/inf?name=wk"
Gets the original URL of the current request
Request.rawurl; "/aspnet/zz/zz.aspx/inf?name=wk"
Gets information about the URL that was last requested by the client, which is linked to the current URL.
Request.urlreferrer; "System.Uri"
Get browser information
GET request Information