Mani Pazhana
asked on
Request.Cookie
Heelo Experts,
I am having issues in removing Request.Cookie on my ASP.Net page.
-------------------------- ---------- ---------- ---------- -----
I do see the cookies in Request collection. But I could not clean them from my page.
-------------------------- ---------- ---------- ---------- --
?Request.Cookies.Count
3
-------------------------- ---------- ---------- ----
?Request.Cookies.Item(0)
{System.Web.HttpCookie}
Domain: Nothing
Expires: #12:00:00 AM#
HasKeys: False
Item: <cannot view indexed property>
Name: "state%2Epa%2Eus"
Path: "/"
Secure: False
Value: "564F8D424FAADCACC89595B57 98F3606DE0 81B153C222 D544EFBFBC 74055BC5A1 CE8744AA8A 439B50162F 9DC9987DD4 B23D63B778 6684FDFA13 C35651FF64 3DC2B4C681 3FCDA83078 59E043A040 F6AF01D2BC 11B6FFB7BF 487524040B 57289CDE7D ECCF1AF9E7 EF6EE6B1BB F2FC941E16 2191367445 D952996666 A7F42971B9 5"
Values: {System.Web.HttpValueColle ction}
?Request.Cookies.Item(1)
{System.Web.HttpCookie}
Domain: Nothing
Expires: #12:00:00 AM#
HasKeys: False
Item: <cannot view indexed property>
Name: "ASP.NET_SessionId"
Path: "/"
Secure: False
Value: "5mb4k3ua1ezir2afenbxim45"
Values: {System.Web.HttpValueColle ction}
?Request.Cookies.Item(2)
{System.Web.HttpCookie}
Domain: Nothing
Expires: #12:00:00 AM#
HasKeys: False
Item: <cannot view indexed property>
Name: ".ASPXAUTH"
Path: "/"
Secure: False
Value: "6984F94F9B76C2170D27C711C 30D0990ED4 CA4893B2AC E978CAED6F 4D758C3D87 775572A05E AF0A3BF1CA 1F9FF6796B F1CC99F398 42860E20CE 8B6F6A7239 1DDB8C0599 1BE473FDEB 015C724B01 8563CC404E E4C4C1542C 3"
Values: {System.Web.HttpValueColle ction}
-------------------------- ---------- ---------- ---------- ---------- --
?Response.Cookies.Count
0
-------------------------- ---------- ---------- ---------- ----------
if you see above results, there is no Response.Cookie but there is some Request.Cookies.
-------------------------- ---------- ---------- ---------- ---
I tried the following syntax: no luck so far.
' Work with cookies
Dim testCookie As New HttpCookie("state%2Epa%2Eu s")
testCookie.Expires = DateTime.Now.AddYears(-30)
Dim MyCookie As System.Web.HttpCookie = Request.Cookies("state%2Ep a%2Eus")
MyCookie.Expires = DateTime.Now.AddYears(-30)
Dim objCookieColl As HttpCookieCollection
objCookieColl = Request.Cookies
objCookieColl.Remove("stat e%2Epa%2Eu s")
Dim strUS As String
strUS = "state%2Epa%2Eus"
Request.Cookies(strUS).Exp ires = DateTime.Now.AddYears(-10)
Request.Cookies.Remove(str US)
Request.Cookies.Clear()
Request.Cookies.Item(0).Ex pires = DateTime.Now.AddDays(-10)
-------------------------- ---------- ---------
Can someone help me out with this issue? Thanks
I am having issues in removing Request.Cookie on my ASP.Net page.
--------------------------
I do see the cookies in Request collection. But I could not clean them from my page.
--------------------------
?Request.Cookies.Count
3
--------------------------
?Request.Cookies.Item(0)
{System.Web.HttpCookie}
Domain: Nothing
Expires: #12:00:00 AM#
HasKeys: False
Item: <cannot view indexed property>
Name: "state%2Epa%2Eus"
Path: "/"
Secure: False
Value: "564F8D424FAADCACC89595B57
Values: {System.Web.HttpValueColle
?Request.Cookies.Item(1)
{System.Web.HttpCookie}
Domain: Nothing
Expires: #12:00:00 AM#
HasKeys: False
Item: <cannot view indexed property>
Name: "ASP.NET_SessionId"
Path: "/"
Secure: False
Value: "5mb4k3ua1ezir2afenbxim45"
Values: {System.Web.HttpValueColle
?Request.Cookies.Item(2)
{System.Web.HttpCookie}
Domain: Nothing
Expires: #12:00:00 AM#
HasKeys: False
Item: <cannot view indexed property>
Name: ".ASPXAUTH"
Path: "/"
Secure: False
Value: "6984F94F9B76C2170D27C711C
Values: {System.Web.HttpValueColle
--------------------------
?Response.Cookies.Count
0
--------------------------
if you see above results, there is no Response.Cookie but there is some Request.Cookies.
--------------------------
I tried the following syntax: no luck so far.
' Work with cookies
Dim testCookie As New HttpCookie("state%2Epa%2Eu
testCookie.Expires = DateTime.Now.AddYears(-30)
Dim MyCookie As System.Web.HttpCookie = Request.Cookies("state%2Ep
MyCookie.Expires = DateTime.Now.AddYears(-30)
Dim objCookieColl As HttpCookieCollection
objCookieColl = Request.Cookies
objCookieColl.Remove("stat
Dim strUS As String
strUS = "state%2Epa%2Eus"
Request.Cookies(strUS).Exp
Request.Cookies.Remove(str
Request.Cookies.Clear()
Request.Cookies.Item(0).Ex
--------------------------
Can someone help me out with this issue? Thanks
ASKER
There is nothing in Response.Cookies.Count.
I see cookies in Request.Cookies.Count. I want to remove the cookies from Request.Cookies.
Also I tried Response.Cookies, no luck.
Any idea?
I see cookies in Request.Cookies.Count. I want to remove the cookies from Request.Cookies.
Also I tried Response.Cookies, no luck.
Any idea?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Response.Cookies.Clear() did not clear Request.Cookies.Count, still the value exists.
use Response instead of Request..
eg:
Response.Cookies.Clear()