Storing Cookies

B

Brian Burgess

Hi all,

Anyone know of any special issues with storing cookies with ASP? I'm
trying this with two browsers: One is IE 6.0 with cookies set to
'prompt'. This has been working properly as any new site I goto seems
to prompt me to store their cookie. The other is Pocket IE on Pocket
PC 2002, with the cookies set to 'enabled'.

My problem is that the cookies dont seem to be being written with my
ASP. I dont get the prompt to store the cookie when I should. My
storage code looks like this:

Response.Cookies("AcctNbr") = nAcctNbr
Response.Cookies("MsgStart") = nMsgStart
Response.Cookies("MsgEnd") = nMsgEnd
Response.Cookies("AcctNbr").Expires = DateAdd("h", 15, Now)
Response.Cookies("MsgStart").Expires = DateAdd("h", 15, Now)
Response.Cookies("MsgEnd").Expires = DateAdd("h", 15, Now)


And the read code looks like this:

If Not(Request.Cookies("AcctNbr")="") Then
nAcctNbr = CInt(Request.Cookies("AcctNbr"))
End If
If Not(Request.Cookies("MsgStart")="") Then
nMsgStart = CInt(Request.Cookies("MsgStart"))
End If
If Not(Request.Cookies("MsgEnd")="") Then
nMsgEnd = CInt(Request.Cookies("MsgEnd"))
End If


Of course nothing is read in, but past that, my browser does not
prompt for storage either..

Any ideas?

Thanks in advance...

-BB
 
M

Mike Moore [MSFT]

Hi Brian,

You asked if ASP does something special with cookies. No, it sends them to
the browser in the normal manner.

You also wrote that you verified that IE6 is receiving cookies from sites
that you visit, but it appears that pocket IE is not receiving cookies.

When you visit your own web page with IE6 multiple times in a row, does it
receive the values from the cookies? Can you repeat this with Pocket IE? I
think the error is with Pocket IE rather than with the web site.

Thank you, Mike
Microsoft, ASP.NET

Microsoft Security Announcement: Have you installed the patch for Microsoft
Security Bulletin MS03-039? If not, Microsoft strongly advises you to
review the information at the following link regarding Microsoft Security
Bulletin MS03-039
http://www.microsoft.com/technet/security/bulletin/ms03-039.asp and/or to
visit Windows Update at http://windowsupdate.microsoft.com to install the
patch. Running the Windows Update scan will help to insure you are current
with all security patches, not just MS03-039.

Microsoft also highly recommends to all customers that you visit the
http://www.microsoft.com/protect site and perform the three straightforward
steps listed to improve your computer’s security.

This posting is provided "AS IS", with no warranties, and confers no rights.


--------------------
 
B

Brian Burgess

Well I have my IE60 set to prompt to accept all cookies. And I have
tried a sample cookie setting and reading page from the CodeProject.
This works and prompts me on my IE60 to save the cookie. .. It IS
something I'm doing wrong in my ASP .. just cant figure out what ..
:-(
 
B

BrianJian

What 's the value of nAcctNbr,nMsgStart,nMsgEnd?
This is where the problem exists.
 
M

Mike Moore [MSFT]

Hi Brian,

I'd like to return to basics for this. Please start a new blank page and
add this code. Then browse it and then refresh the page with IE and Pocket
IE. Then post the results.
<%
Response.Write Request.Cookies("abc")
Response.Cookies("abc") = "123"
Response.CacheControl="no-cache"
%>

Thank you, Mike
Microsoft, ASP.NET

Microsoft highly recommends to all of our customers that they visit the
http://www.microsoft.com/protect site and perform the three straightforward
steps listed to improve your computer’s security.

This posting is provided "AS IS", with no warranties, and confers no rights.


--------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top