ASP .net current physical location

后端 未结 2 1297

Hi I am developing an ASP.net web application. I need to find the current location (physical) of the web site (or the bin directory containing the assemblies).

I have t

相关标签:
2条回答
  • 2021-02-19 15:55

    You need System.Web.HttpRuntime.BinDirectory (physical path to the bin folder) and System.Web.HttpRuntime.AppDomainAppPath (physical path to the top-level ASP.NET application folder).

    0 讨论(0)
  • 2021-02-19 15:56

    It depends on exactly what you want to do with the path, but the usual approach is Server.MapPath(). For example:

    YourControl.src = Server.MapPath("~/images/image1.jpg");
    

    That will return the physical path for the specified file.

    0 讨论(0)
提交回复
热议问题