Accessing ASP Cookie in ASP.Net using VB.NET
This article shows how to access ASP Cookie in ASP.Net.
Get the SessionCookie
With the ASP application web server set a cookie with a
name that starts with ASPSESSION. This is the ASP Session cookie. All subsequent
requests sent from the client to the server will include the ASP Session cookie
along with the request. This cookie allows IIS to associate the request with a
specific session object that is stored on the server.
If you have ASP and ASP.NET applications running in the
same virtual directory means having ASP & ASPX pages in same virtual directory.
An ASP session and an ASP.NET session have been established with the same
server, the browser will send both the ASP and ASP.NET cookies with each
Following code tells how to find ASP cookie from
ASP.Net for above seen.
Public Class ASPSessionVar
Dim oContext As HttpContext
Public Sub New(ByVal
oContextIn As HttpContext)
oContext = oContextIn
Dim i As
Dim Ck As HttpCookie
Dim CkArray() As String = oContext.Request.Cookies.AllKeys
CkName = ""
CkValue = ""
i = 0
While i < CkArray.Length
If (ck.Name.StartsWith("ASPSESSION")) Then
CkName = Ck.Name
CkValue = Ck.Value