473,395 Members | 1,761 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Remember Me on this Machine

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
May 29 '06 #1
4 1879
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

May 29 '06 #2
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


May 29 '06 #3
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



May 29 '06 #4
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



May 29 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
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...
12
by: francisds | last post by:
Hi, Can you guys see if there's a solution to this problem? I have a database from which I have to read each record and process that record. New records are being added all the time, so I...
1
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'...
1
by: M O J O | last post by:
(using asp.net 2.0) Hi, I have 5-6 large customers each using the same pages, but with their own themes. To enter my site, they all have their own urls like ... ...
6
by: Charleees | last post by:
Hi all, I have a Login Page whrere all Functionalities such as validations are Done in Client Side... I have to Implement Remember My Mail Id and PAss Word Functionality also in Client side.....
0
by: Frank Miverk | last post by:
Hi, I am not understanding how the Remember Me checkbox is supposed to work here. I have a LoginCtrl (asp.net 2.0, framework 2.0) and all I want to do is remember the user the next time if they...
1
by: Abdo Haji-Ali | last post by:
Greetings, I'm using the ASP.NET membership model in my site and everything works perfectly, locally. However when I uploaded my site (To my host which is GoDaddy), and ran it remotely the...
28
by: jatrojoomla | last post by:
Hi! could anyone give me some clue that how to create 'remember login' functionality during login Thanks Sukalyan
1
by: =?Utf-8?B?VEo=?= | last post by:
Hi, Environment : Asp.net 2.0 / C# As you know, there is a "Remember me" check box in Login control is VS.NET 2005. It allows you to get in the page without logging it if user closes browser,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
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
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
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...
0
Oralloy
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,...
0
jinu1996
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...
0
tracyyun
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 using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.