Name
ApplyAppPathModifier
Synopsis
String = Response.ApplyAppPathModifier(ByVal virtualPath_
As String)Given a virtual path to a resource, returns a string containing a new virtual path containing the SessionID. This new virtual path can be used to create absolute URLs for use in applications that use cookieless Sessions.
Parameters
-
String A String argument that will receive the modified virtual path.
-
virtualPath A String argument containing the virtual path to be modified.
Example
The following example retrieves a virtual path including the SessionID and displays the path by using the Text property of the Message label control:
Sub Page_Load( ) Dim NewPath As String NewPath = Response.ApplyAppPathModifier(Request.Path) Message.Text = "Modified virtual path = " & NewPath End Sub
The web.config file to set the Session state
handler to use cookieless Sessions is shown below:
<configuration>
<system.web>
<sessionState mode="InProc" cookieless="true"/>
</system.web>
</configuration>Notes
This method is very useful when making use of the cookieless Session
state functionality introduced by ASP.NET. If the cookieless
attribute of the sessionState config section in
web.config is not set to
True, this method will simply return the virtual
path passed in without modification.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access