HttpResponse.ApplyAppPathModifier(String) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
如果虛擬路徑使用 Cookieless 會話狀態,則會為虛擬路徑新增一個 ID,並回傳合併後的路徑。 若 Cookieless 未使用會話狀態,則 ApplyAppPathModifier(String) 回傳原始虛擬路徑。
public:
System::String ^ ApplyAppPathModifier(System::String ^ virtualPath);
public string ApplyAppPathModifier(string virtualPath);
member this.ApplyAppPathModifier : string -> string
Public Function ApplyAppPathModifier (virtualPath As String) As String
參數
- virtualPath
- String
通往資源的虛擬路徑。
傳回
那個插入了會話 ID 的版本 virtualPath 。
範例
以下範例宣告一個名為 urlConverted的字串變數,並將其設為方法呼叫的 ApplyAppPathModifier 結果。 程式碼接著將NavigateUrl變數的值傳遞給HyperLink控制項的屬性。
// Declare a string variable and set it to the result
// of a call to the ApplyAppPathModifier method.
// Then set the NavigateUrl property of a Hyperlink control
// to the string's value.
string urlConverted = Response.ApplyAppPathModifier("TestPage.aspx");
hlTest1.NavigateUrl = urlConverted;
' Declare a string variable and set it to the result
' of a call to the ApplyAppPathModifier method.
' Then set the NavigateUrl property of a Hyperlink control
' to the string's value.
Dim urlConverted As String = Response.ApplyAppPathModifier("TestPage.aspx")
hlTest1.NavigateUrl = urlConverted
備註
ApplyAppPathModifier 僅用於無 cookie 會話以構建絕對 HREF。