ASP.NET中的路径问题

来源:互联网 发布:青牛软件最新消息 编辑:程序博客网 时间:2024/05/20 06:31
这是我页面请求链接http://localhost/MyWeb/Store/Page1.aspx?ddddd=9。下面是通过相应方法显示的路径,对比一下应该可以找到你想要的取得路径的方法。
Request.RawUrl
原始 URL 定义为 URL 中域信息之后的部分。在 URL 字符串 http://www.contoso.com/articles/recent.aspx 中,原始 URL 为/articles/recent.aspx。原始 URL 包括查询字符串(如果存在)。
/MyWeb/Store/Page1.aspx?ddddd=9
Request.Path
当前请求的虚拟路径。
/MyWeb/Store/Page1.aspx
Request.PathInfo
对于URL Http://www.contoso.com/virdir/page.html/tail,PathInfo 值为/tail。
 
Request.CurrentExecutionFilePath  Request.FilePath
CurrentExecutionFilePath 在重定向方案(如 Execute Transfer)中返回当前所执行页的正确文件路径。当客户端重定向到另一页时,FilePath 将返回初始页的路径;CurrentExecutionFilePath 返回子页的路径。
/MyWeb/Store/Page1.aspx
Request.PhysicalApplicationPath
获取当前正在执行的服务器应用程序的根目录的物理文件系统路径。(应用程序的跟目录)
k:/MyWeb/MyWeb/
Request.PhysicalPath
获取与请求的 URL 相对应的物理文件系统路径。
k:/MyWeb/MyWeb/Store/Page1.aspx
Request.ApplicationPath
获取服务器上 ASP.NET 应用程序的虚拟应用程序根路径。
/MyWeb
AppDomain.CurrentDomain.BaseDirectory
获取基目录,它由程序集冲突解决程序用来探测程序集。
k:/MyWeb/MyWeb/
AppDomain.CurrentDomain.RelativeSearchPath
获取相对于基目录的路径,在此程序集冲突解决程序应探测专用程序集。
Bin
Assembly.CodeBase
获取最初指定的程序集的位置
file:///k:/MyWeb/MyWeb/bin/MyWeb.DLL
Assembly.Location
如果包含清单的已加载文件没有被影像复制,则获取该文件的基本代码格式的位置。
c:/windows/microsoft.net/framework/v1.1.4322/temporary asp.net files/myweb/a6aa4523/7564b5f7/assembly/dl2/19cb75f7/002a8314_c272c601/myweb.dll
Request.Server.MapPath()
将指定的虚拟路径映射到物理路径。
 
 
原创粉丝点击