Re: Remember Me on this Machine

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



I forgot to give you the line for cookie duration

Response.Cookies["username"].Value = "Fred"
Response.Cookies["username"].Expires = DateTime.Now.AddDays(1)

That way when you try and read it back it should exist in the clients
browser cookie cache.

Have a read of the cookie guide for asp.net - it explains it all
beautifully.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstechart/html/vbtchASPNETCookies101.asp

--
Regards

John Timney
Microsoft MVP

"Samuel Shulman" <samuel.shulman@xxxxxxxxxxxx> wrote in message
news:eU78CR1gGHA.4776@xxxxxxxxxxxxxxxxxxxxxxx
Thank you for your response,

It doesn't seem to work on my machine

Does the following line:
Response.Cookies["username"].Value = "Fred";
suppose to save the cookie in file so it can be used in the Load event of
the Login page next time the user will try to log on

Samuel

"John Timney ( MVP )" <timneyj@xxxxxxxxxxxxx> wrote in message
news:OthTKS0gGHA.1204@xxxxxxxxxxxxxxxxxxxxxxx
If all your looking to do is set a cookie and retrive it then its as easy
as:

Using System.Web;
Response.Cookies["username"].Value = "Fred";

and to read it back again
Response.Write(Request.Cookies["username"].Value);

There are some examples around already using forms authentication like
http://www.aspcode.net/default.aspx?p=a&i=112

I'm sure you can fish around for more.

--
Regards

John Timney
Microsoft MVP


--
Regards

John Timney
Microsoft MVP

"Samuel Shulman" <samuel.shulman@xxxxxxxxxxxx> wrote in message
news:%23NgiAkzgGHA.3900@xxxxxxxxxxxxxxxxxxxxxxx
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

Thank you,
Samuel







.



Relevant Pages

  • Windows XP IE browser cookie session doesnt get deleted
    ... where i use browser cookie for Single-Sign-On ... after user does login to our system. ... I'm using JSP to set the cookie using Java HTTP Cookie class. ...
    (microsoft.public.windows.inetexplorer.ie6.browser)
  • Re: Remember Me on this Machine
    ... 'Put user code to initialize the page here ... Have a read of the cookie guide for asp.net - it explains it all ... John Timney ... believe using cookies that next time when the user comes to the login ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Session Cookie not accessible across Sub-Domains
    ... You can't share sessions across domains, nor applications natively - so it ... will always set a new cookie as you move between domains. ... >> John Timney ... >> ASP.NET MVP ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Remember Me on this Machine
    ... suppose to save the cookie in file so it can be used in the Load event of ... John Timney ... using cookies that next time when the user comes to the login page I can ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Remember Me on this Machine
    ... If all your looking to do is set a cookie and retrive it then its as easy ... John Timney ... add the Userename to the appropriate Textbox ...
    (microsoft.public.dotnet.framework.aspnet)