CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2003
    Location
    Mumbai, Maharashtra INDIA
    Posts
    20

    Session Vs Cookies and Back Button

    Hi Guys,

    What is the advantage of using Session over cookies and vice versa...?

    Also I have question IE browser's back Button

    When we click this back button, is the previous page not executed at the server side? is it loaded from the memory? How do we disable this coz I have Login Page and on successful login I goto Setting's Page. But from Settting's Page I go back to Login and find that I can move forward to the Setting's page irrespective of being on login page. Coz I should be theoretically Logged Out of the system when I go back to my Login Page.

    That also call for some insight on logging Off a Web System. Any points regarding Logout that are specific or easy with ASP.NET?

    Please Help....

    Thx
    Last edited by vinitsankhe; November 3rd, 2006 at 08:52 AM.
    V.V.Sankhe

  2. #2
    Join Date
    Dec 2005
    Location
    Waterloo ON
    Posts
    545

    Re: Session Vs Cookies and Back Button

    Session is state data stored server-side, while cookie is state data stored client-side. Many users disabled saving cookie.

    When user click back button in IE, the previous page is loaded from cache not from server.

    You can create session data when login and abandon all session data when logout. And check session data when page_load on every secured webpage. If Session.Count > 0 then go ahead, if not go back to login.aspx.

    However, if user click back button after logout, the webpage isnot loaded from server, so you can't check session. Maybe you should use cookie and check it using javascript in window.onload.
    Code:
    window.onload=function()
    {
    	if(getCookie('logged') == null)
    	{
    		window.location.assign('Login.aspx');
    		return;
    	}
    }

  3. #3
    Join Date
    Oct 2003
    Location
    Mumbai, Maharashtra INDIA
    Posts
    20

    Re: Session Vs Cookies and Back Button

    Thx :-)
    V.V.Sankhe

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured