Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Cookies problem (again)

Reply
Thread Tools

Cookies problem (again)

 
 
The Clansman
Guest
Posts: n/a
 
      05-19-2004
Hi,
I tried this in the btnLogin_Click event:

Response.Cookies("UserEmail").Value = txtEmail.Text
Response.Cookies("UserEmail").Expires =
DateTime.Now.AddMonths(1)

and in the Page_Load event I do this:

txtEmail.Text = Response.Cookies("UserEmail").Value

but the return value is still empty, I can read the cookie if I try to read
as soon I write it:

Response.Cookies("UserEmail").Value = txtEmail.Text
Response.Cookies("UserEmail").Expires =
DateTime.Now.AddMonths(1)
txtEmail.Text = Response.Cookies("UserEmail").Value

Thanks,
Bruno


 
Reply With Quote
 
 
 
 
GD
Guest
Posts: n/a
 
      05-20-2004
Once you have set the cookie value you read it back using the "Request"
object (not the Response object as in your code sample)

Assuming you have already written a value to the cookie, use the following
line to read the value back

txtEmail.Text = Request.Cookies("UserEmail").Value

Gary


"The Clansman" <Yeah! Send me spam!! I love it!! But send the porn ones....>
wrote in message news:(E-Mail Removed)...
> Hi,
> I tried this in the btnLogin_Click event:
>
> Response.Cookies("UserEmail").Value = txtEmail.Text
> Response.Cookies("UserEmail").Expires =
> DateTime.Now.AddMonths(1)
>
> and in the Page_Load event I do this:
>
> txtEmail.Text = Response.Cookies("UserEmail").Value
>
> but the return value is still empty, I can read the cookie if I try to

read
> as soon I write it:
>
> Response.Cookies("UserEmail").Value = txtEmail.Text
> Response.Cookies("UserEmail").Expires =
> DateTime.Now.AddMonths(1)
> txtEmail.Text = Response.Cookies("UserEmail").Value
>
> Thanks,
> Bruno
>
>



 
Reply With Quote
 
 
 
 
The Clansman
Guest
Posts: n/a
 
      05-20-2004
wow!

I need to get new eyes! :S hehehe

thanks

"The Clansman" <Yeah! Send me spam!! I love it!! But send the porn ones....>
wrote in message news:(E-Mail Removed)...
> Hi,
> I tried this in the btnLogin_Click event:
>
> Response.Cookies("UserEmail").Value = txtEmail.Text
> Response.Cookies("UserEmail").Expires =
> DateTime.Now.AddMonths(1)
>
> and in the Page_Load event I do this:
>
> txtEmail.Text = Response.Cookies("UserEmail").Value
>
> but the return value is still empty, I can read the cookie if I try to

read
> as soon I write it:
>
> Response.Cookies("UserEmail").Value = txtEmail.Text
> Response.Cookies("UserEmail").Expires =
> DateTime.Now.AddMonths(1)
> txtEmail.Text = Response.Cookies("UserEmail").Value
>
> Thanks,
> Bruno
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Give Request.Cookies and Response.Cookies is there any reason to use another method to use cookies? _Who ASP .Net 7 09-18-2008 07:49 PM
What's the proper way of reading cookies? Request.Cookies("mycook") doesnt work user ASP .Net 3 03-31-2007 01:53 PM
Response.Cookies vs Request.Cookies Alex Nitulescu ASP .Net 1 02-03-2005 09:43 AM
Persistent Cookies vs. session cookies Andy Fish Java 3 11-06-2003 10:44 AM
Good Cookies bad Cookies? AK Computer Support 23 10-26-2003 05:20 AM



Advertisments