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 4726
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: 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: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
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...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |