Application.Path プロパティ
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
アプリケーションに関連付けられている相対を取得または設定します。
public:
property System::String ^ Path { System::String ^ get(); void set(System::String ^ value); };
public string Path { get; set; }
member this.Path : string with get, set
Public Property Path As String
プロパティ値
アプリケーションがバインドされている相対パス。
例
次の例では、既定の Web サイトで構成されたアプリケーションの相対パスを表示します。
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Web.Administration;
using Microsoft.Web.Management;
namespace AdministrationSnippets
{
public class AdministrationApplicationPath
{
// Writes out the application paths found under the default Web site.
public void GetPath()
{
ServerManager manager = new ServerManager();
Site defaultSite = manager.Sites["Default Web Site"];
foreach (Application app in defaultSite.Applications)
{
Console.WriteLine(
"Found application with the following path: {0}",
app.Path);
}
}
}
}
次の例では、新しいアプリケーションを作成し、 プロパティを Path 使用してアプリケーションの相対パスを変更し、 プロパティを PhysicalPath 使用してアプリケーションの物理パスを変更します。
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Web.Administration;
using Microsoft.Web.Management;
namespace AdministrationSnippets
{
public class AdministrationApplicationPath
{
// Creates an application and sets its associated path.
public void SetPath()
{
// Create a new application.
ServerManager manager = new ServerManager();
Site defaultSite = manager.Sites["Default Web Site"];
defaultSite.Applications.Add("/blogs1", @"C:\inetpub\wwwroot\");
manager.CommitChanges();
// Change the relative path.
manager = new ServerManager();
defaultSite = manager.Sites["Default Web Site"];
defaultSite.Applications["/blogs1"].Path = @"/blogs2";
manager.CommitChanges();
// Change the physical path.
manager = new ServerManager();
defaultSite = manager.Sites["Default Web Site"];
defaultSite.Applications["/blogs2"].VirtualDirectories["/"].PhysicalPath
= @"C:\inetpub\wwwroot\blogs";
manager.CommitChanges();
}
}
}
注釈
この値は、アプリケーションのルートのパスを表します。