I managed to write but I can't read,
Is it related to the fact that it is running on my own computer?
Is it because it is the first request?
The code is below
Thank you,
Samuel
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
obLogin = New clsLoginManager(Session)
'Read the username from the machine
If Not IsNothing(Response.Cookies("Username")) Then
If Not IsNothing(Response.Cookies("Username").Value) Then
txtUserName.Text = Response.Cookies("Username").Value.ToString
End If
End If
End Sub
"John Timney ( MVP )" <ti*****@despammed.com> wrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
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/de...Cookies101.asp
--
Regards
John Timney
Microsoft MVP
"Samuel Shulman" <sa************@ntlworld.com> wrote in message
news:eU**************@TK2MSFTNGP05.phx.gbl... 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 )" <ti*****@despammed.com> wrote in message
news:Ot**************@TK2MSFTNGP02.phx.gbl... 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" <sa************@ntlworld.com> wrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
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