HttpResponse.ApplyAppPathModifier(String) HttpResponse.ApplyAppPathModifier(String) HttpResponse.ApplyAppPathModifier(String) HttpResponse.ApplyAppPathModifier(String) Method

定义

如果会话使用 Cookieless 会话状态,则将该会话 ID 添加到虚拟路径中,并返回组合路径。Adds a session ID to the virtual path if the session is using Cookieless session state and returns the combined path. 如果不使用 Cookieless 会话状态,则 ApplyAppPathModifier(String) 返回原始的虚拟路径。If Cookieless session state is not used, ApplyAppPathModifier(String) returns the original virtual path.

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 String String String

资源的虚拟路径。The virtual path to a resource.

返回

已插入会话 ID 的 virtualPathThe virtualPath with the session ID inserted.

示例

下面的示例声明一个名为urlConverted的字符串变量,并将其设置为ApplyAppPathModifier方法调用的结果。The following example declares a string variable named urlConverted, and sets it to the result of an ApplyAppPathModifier method call. 然后,代码将变量的值传递到HyperLink控件的NavigateUrl属性。The code then passes the variable's value to a HyperLink control's NavigateUrl property.

// 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。ApplyAppPathModifier is used only with cookieless sessions to construct absolute HREFs.

适用于