ASP.NET not writing cookies, not using codebehind file

P

Phoenix

Hi,

I figured this one out before and have forgotten the answer. I have an
..aspx page that has user settable options. When you click an option in
the listbox for example, it should save that option as a cookie as long
as your browser is open..The minute you leave the page and come back
(same site), it forgets. I am writing the cookie in the
page_load...Here's my code....Also, i'm not using codebehind and am not
compiling. (This is a one-off .NET page integrated within a legacy ASP
site.) Am I missing something in my GLobal.asax? my web.config? Help
please?! I have it working in a compiled version of a different ASP.NET
site and can't see where I've gone wrong.

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

If isPostBack Then

pil_category = lbPILCategory.SelectedItem.Value
Response.Cookies("session")("pilcategory")= pil_category

Response.write("cookie="&pil_category) 'this writes the correct
answer
else

pil_category = Request.Cookies("session")("pilcategory")
Response.write("pilcategory="&pil_category)
if pil_category <> NOTHING then
lbPILCategory.SelectedValue = pil_category
end if

end if

end sub
 

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

Similar Threads

Cookies Count 2
Using Cookies 0
Cookies 1
Cookies during error handling 1
Cookies and Events Problems 1
cookies.... 1
Problem with accessing cookies? 3
urgent-codebehind not working 0

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top