简体   繁体   English

如何在ASP.NET应用程序中找到路径

[英]How to locate a path in ASP.NET application

How to locate a place on a machine(virtual path) in an ASP.NET APPLICATION, 如何在ASP.NET应用程序中找到计算机上的位置(虚拟路径),

the problem is this, In windows or desktop application we have .exe in debug folder so can refer other files relatively to .exe like ..\\resources mean one folder upper of .exe there is a resouce folder, if i want to do the same in web application how to do that 问题是这个,在Windows或桌面应用程序中我们在调试文件夹中有.exe所以可以引用相对于.exe的其他文件,比如.. \\ resources意味着.exe的一个文件夹上面有一个resouce文件夹,如果我想做的话在Web应用程序中如何做到这一点

In the HttpContext you can find a lot of helpful properties 在HttpContext中,您可以找到许多有用的属性

HttpRequest.ApplicationPath
HttpRequest.PhysicalApplicationPath
HttpRequest.PhysicalPath

and others. 和别的。

See http://msdn.microsoft.com/en-us/library/ms178116(v=vs.100).aspx There is a nice table with detailed explanations in the end of page. 请参阅http://msdn.microsoft.com/en-us/library/ms178116(v=vs.100).aspx在页面末尾有一个很好的表格,详细解释。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM