song2siren
Programmer
Hello
I'm using cookies to track users around a shopping cart application, but I cannot seem to retrieve a cookie value on the secure part of my site.
I'm using the following code to either generate a new ID or retrieve an existing one:
Public Function GetShoppingCartId() As String
Dim _guidUserID As GUID
Dim objCookie As HttpCookie
objCookie = HttpContext.Current.Request.Cookies( "ConfUserID" )
If objCookie Is Nothing Then
_guidUserID = Guid.NewGuid
objCookie = New HttpCookie( "ConfUserID", _guidUserID.ToString )
objCookie.Expires = DateTime.Now.AddYears( 3 )
HttpContext.Current.Response.Cookies.Add( objCookie )
Return HttpContext.Current.Request.Cookies( "ConfUserID" ).Value
Else
Return objCookie.Value
End If
End Function
However, on any HTTPS pages an new ID and cookie is always generated. Any help suggestions would be very much appreciated.
Thanks
I'm using cookies to track users around a shopping cart application, but I cannot seem to retrieve a cookie value on the secure part of my site.
I'm using the following code to either generate a new ID or retrieve an existing one:
Public Function GetShoppingCartId() As String
Dim _guidUserID As GUID
Dim objCookie As HttpCookie
objCookie = HttpContext.Current.Request.Cookies( "ConfUserID" )
If objCookie Is Nothing Then
_guidUserID = Guid.NewGuid
objCookie = New HttpCookie( "ConfUserID", _guidUserID.ToString )
objCookie.Expires = DateTime.Now.AddYears( 3 )
HttpContext.Current.Response.Cookies.Add( objCookie )
Return HttpContext.Current.Request.Cookies( "ConfUserID" ).Value
Else
Return objCookie.Value
End If
End Function
However, on any HTTPS pages an new ID and cookie is always generated. Any help suggestions would be very much appreciated.
Thanks