Thread: session problem
View Single Post
  #6 (permalink)  
Old October 5th, 2007, 05:04 AM
Imar's Avatar
Imar Imar is offline
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts

quote:well i am not sure i am asking if i will store username only in cookie but in web site user have to provide password also with that username so i am thinking that if i store username only in cookie an dif any person read it then he may not be able to use web site as he donot have password. am i right?
Yes, true. ALthough IMO it's still a security risk. Up to you though....
quote:yes i am sure sessions are not working. you said right.
I don't believe that. Try this:

1. Create an ASPX page with this markup:
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
<a href="">Go to Google</a>
2. In Code Behind add this:
Session["Test"] = "Something";
Label1.Text = Session.SessionID;
(Notice it's important to assign something to Session state first.
3. Run the page. Note the Session ID
4. Click the link to go to Google
5. Click the back button
6. Press Ctrl+F5 to refresh the page a couple of times.

The ID will be the same as in step 3.
quote:link refer to a help page from where i can get code how to store values in cookies and read them.
The best link is Searching for Cookies ASP.NET should give you plenty results to work with.


Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004