hi,
I'm trying to remember a user who has visited the page. what i found out was
to use persistent cookie, is there any other way that i can remember the
user next time he visit?
When using cookies, I used the code below to add
-----in login.aspx------
Dim aCookie As New HttpCookie("userInfo")
aCookie.Values("userID") = "1"
aCookie.Expires = DateTime.Now.AddYears(50)
Response.Cookies.Add(aCookie)
and to retrieve, I used
-----in default.aspx------
Server.HtmlEncode(Request.Cookies("userInfo")("use rId"))
but I wasn't able to retrieve values from the cookies. does it matter where
I create the cookies, as i check for the cookie in default.aspx and redirect
to login.aspx if the cookie is not found.
Hope someone can help!
Thank You!!! 5 4725
Hi James,
One possible reason you can't retrieve cookie is that your browser blocks
cookie. Hence it never writes cookie to client computer.
HTH
Elton Wang
"James" wrote: hi, I'm trying to remember a user who has visited the page. what i found out was to use persistent cookie, is there any other way that i can remember the user next time he visit?
When using cookies, I used the code below to add -----in login.aspx------ Dim aCookie As New HttpCookie("userInfo") aCookie.Values("userID") = "1" aCookie.Expires = DateTime.Now.AddYears(50) Response.Cookies.Add(aCookie)
and to retrieve, I used -----in default.aspx------ Server.HtmlEncode(Request.Cookies("userInfo")("use rId"))
but I wasn't able to retrieve values from the cookies. does it matter where I create the cookies, as i check for the cookie in default.aspx and redirect to login.aspx if the cookie is not found.
Hope someone can help!
Thank You!!!
James,
Here is some very simple cookie code as an example:
private void Page_Load(object sender, System.EventArgs e)
{
if(Request.Cookies["test"]==null)
{
HttpCookie c = new HttpCookie("test","hello") ;
c.Expires=new DateTime(2007,1,1);
Response.Cookies.Add(c);
}
Response.Write(Request.Cookies["test"].Value);
//....
Peter
--
Co-founder, Eggheadcafe.com developer portal: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
"James" wrote: hi, I'm trying to remember a user who has visited the page. what i found out was to use persistent cookie, is there any other way that i can remember the user next time he visit?
When using cookies, I used the code below to add -----in login.aspx------ Dim aCookie As New HttpCookie("userInfo") aCookie.Values("userID") = "1" aCookie.Expires = DateTime.Now.AddYears(50) Response.Cookies.Add(aCookie)
and to retrieve, I used -----in default.aspx------ Server.HtmlEncode(Request.Cookies("userInfo")("use rId"))
but I wasn't able to retrieve values from the cookies. does it matter where I create the cookies, as i check for the cookie in default.aspx and redirect to login.aspx if the cookie is not found.
Hope someone can help!
Thank You!!!
IE Cookie Viewer is a good tool to find and use when debugging cookies. So
is any recent releases of Firefox or Netscape.
<%= Clinton Gallagher
METROmilwaukee (sm) "A Regional Information Service"
NET csgallagher AT metromilwaukee.com
URL http://metromilwaukee.com/
URL http://clintongallagher.metromilwaukee.com/
"James" <po*****@gmail.com> wrote in message
news:Og**************@TK2MSFTNGP11.phx.gbl... hi, I'm trying to remember a user who has visited the page. what i found out was to use persistent cookie, is there any other way that i can remember the user next time he visit?
When using cookies, I used the code below to add -----in login.aspx------ Dim aCookie As New HttpCookie("userInfo") aCookie.Values("userID") = "1" aCookie.Expires = DateTime.Now.AddYears(50) Response.Cookies.Add(aCookie)
and to retrieve, I used -----in default.aspx------ Server.HtmlEncode(Request.Cookies("userInfo")("use rId"))
but I wasn't able to retrieve values from the cookies. does it matter where I create the cookies, as i check for the cookie in default.aspx and redirect to login.aspx if the cookie is not found.
Hope someone can help!
Thank You!!!
Hi,
Thanks for your replies!
I did a check, had my browser to allowed cookies, the cookie was created
thou, but using IE Cookie Viewer recommended by Clinton, the value UserID =
1 was stored when I first access my page, but when I access it the second
time, the cookie exists but the value disappeared!
Is there other possibilities, or any mistake that I could have made?
Thank you! Hope to hear from you soon!
hi poopy,
this may help http://msdn2.microsoft.com/en-us/lib...et.cookie.aspx
"James" <po*****@gmail.com> wrote in message news:%2****************@TK2MSFTNGP09.phx.gbl... Hi,
Thanks for your replies! I did a check, had my browser to allowed cookies, the cookie was created thou, but using IE Cookie Viewer recommended by Clinton, the value UserID = 1 was stored when I first access my page, but when I access it the second time, the cookie exists but the value disappeared!
Is there other possibilities, or any mistake that I could have made?
Thank you! Hope to hear from you soon! This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Joshua Beall |
last post by:
Hi All,
What is the best way to use a cookie to remember a logged in user? Would
you store the username and password in two separate cookies? Should the
password be plain text? Hashed? Not...
|
by: Kai Grossjohann |
last post by:
I have a web app which comprises different frames: a menu bar frame, a
search form frame, a result list frame. Depending on the state, only
a subset of these frames is available. (Eg, after...
|
by: TCORDON |
last post by:
Can someone give me a sample or point me in the direction of one, on how to
implement User "Remember Me" option when logging into a website?
TIA
|
by: |
last post by:
I'm currently at the Macromedia Max Developer Conference in California and
was impressed by vendor's InterAct User Authentication system which
bascially allows one to smash together a 'Remember Me'...
|
by: McGeeky |
last post by:
Is there a way to get a user control to remember its state across pages? I
have a standard page layout I use with a header and footer as user controls.
Each page uses the same layout by means of...
|
by: Brian Henry |
last post by:
I want to make a login form, but have a checkbox with a "remember user name"
option to create a cookie on their system to save their user name and place
it into the username text box when they...
|
by: pek |
last post by:
Any ideas on how to create a remember me option in a login box..?
|
by: Samuel Shulman |
last post by:
Hi
How can I implement a feature of 'Remember me on this computer' I believe
using cookies that next time when the user comes to the login page I can add
the Userename to the appropriate Textbox...
|
by: =?Utf-8?B?QW1pciBUb2hpZGk=?= |
last post by:
Hello
The site I am working on redirects the user to a "session timed out" page
when:
- the user's session has expired AND
- the user action results in a postback to the server
I then...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |