簡體   English   中英

如何獲取網站/應用程序的物理路徑

[英]How to get physical path of a website/app

如何從C#獲取網站的物理路徑(例如“ MyWebSite”)? 我的服務器是IIS 7。

從C#使用msdeploy,我有以下代碼:

var deployBaseOptions = new DeploymentBaseOptions
{
    ComputerName = connectOption.UrlPublishing,
    UserName = connectOption.UserName,
    Password = connectOption.Password,
    AuthenticationType = "Basic",
};

使用Server.MapPath

var path = Server.MapPath("~");

您可以使用以下內容:

var path=HttpContext.Current.Server.MapPath.Tostring();

這里參考

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM