Asp. NET in Request.applicationpath, Request.filepath, Request.path,. Request.mappath

Source: Internet
Author: User

1.Request.applicationpath---Current application directory

2. Virtual directory corresponding to IISRequest.filepath
such as URL Http://mockte.com/1/index.html/pathinfo
FilePath =/1/index.html

3. Virtual path to the current request,Request.path
Path is the concatenation of the FilePath and PathInfo tails. For example URL Http://mockte.com/1/index.html/pathinfo
Then Path =/1/index.html/pathinfo

4.request.mappath (string url), map URLs to virtual directories on IIS
This directory is relative to the root directory of the application.
Does not contain a path like c:/, compared to Server.MapPath
Can be understood as a relative path (the Server.MapPath of the contrast is the absolute path)

5.server.mappath (string url), map the URL to a physical path on the server
For example http://mockte.com/1/index.html assume that your application is in C:/iis/mysite
So that's c:/iis/mysite/1/index.html.

6. The following table is the use of properties related to the URL of browser request

Website: Http://localhost:1897/News/Press/Content.aspx/123?id=1#toc
Request.applicationpath /
Request.PhysicalPath D:/projects/solution/web/news/press/content.aspx
System.IO.Path.GetDirectoryName (Request.PhysicalPath) D:/projects/solution/web/news/press
Request.physicalapplicationpath d:/projects/solution/web/
System.IO.Path.GetFileName (Request.PhysicalPath) Content.aspx
Request.currentexecutionfilepath /news/press/content.aspx
Request.filepath /news/press/content.aspx
Request.path /news/press/content.aspx/123
Request.rawurl /news/press/content.aspx/123?id=1
Request.Url.AbsolutePath /news/press/content.aspx/123
Request.Url.AbsoluteUri Http://localhost:1897/News/Press/Content.aspx/123?id=1
Request.Url.Scheme http
Request.Url.Host localhost
Request.Url.Port 1897
Request.Url.Authority localhost:1897
Request.Url.LocalPath /news/press/content.aspx/123
Request.pathinfo /123
Request.Url.PathAndQuery /news/press/content.aspx/123?id=1
Request.Url.Query ? id=1
Request.Url.Fragment
Request.Url.Segments /
news/
press/
content.aspx/
123

Asp. NET in Request.applicationpath, Request.filepath, Request.path,. Request.mappath

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.