HttpResponse.ApplyAppPathModifier(String) 方法

定義

如果工作階段使用 Cookieless 工作階段狀態並且傳回合併的路徑,則將工作階段 ID 加入虛擬路徑。 如果沒有使用 Cookieless 工作階段狀態,則 ApplyAppPathModifier(String) 會傳回原始虛擬路徑。

public string ApplyAppPathModifier (string virtualPath);

參數

virtualPath
String

資源的虛擬路徑。

傳回

String

已插入工作階段 ID 的 virtualPath

範例

下列範例會宣告名為 的 urlConverted 字串變數,並將它設定為方法呼叫的結果 ApplyAppPathModifier 。 程式碼接著會將變數的值傳遞至 HyperLink 控制項的 NavigateUrl 屬性。

// 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;

備註

ApplyAppPathModifier 只會與無 Cookie 會話搭配使用,以建構絕對 HREF。

適用於