Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Problem in logging Out

Problem in logging Out

Scheduled Pinned Locked Moved ASP.NET
help
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Deepak Nigam
    wrote on last edited by
    #1

    hello friends, In my app, i have a logout buton for which i have written the following code. Session.Remove("UserID"); Session.RemoveAll(); Session.Abandon(); Response.redirect("home.aspx"); But when i press logout button i come back to the last page. that should not be happen bcoz i am having a logincheck usercontrol on that page that cheks wheither Session("UserID") is null or not.......

    Deepak Nigam

    S 1 Reply Last reply
    0
    • D Deepak Nigam

      hello friends, In my app, i have a logout buton for which i have written the following code. Session.Remove("UserID"); Session.RemoveAll(); Session.Abandon(); Response.redirect("home.aspx"); But when i press logout button i come back to the last page. that should not be happen bcoz i am having a logincheck usercontrol on that page that cheks wheither Session("UserID") is null or not.......

      Deepak Nigam

      S Offline
      S Offline
      Sandeep Akhare
      wrote on last edited by
      #2

      As per your comments When User clicks log out button you are clearing Session and redirecting user to Home Page this what you have implemented ... But it is behaving relatively against it

      Deepak Nigam wrote:

      But when i press logout button i come back to the last page.

      How are you going again back to last page ? If you saying by clicking back Button then Page might be coming from browser Cache

      Deepak Nigam wrote:

      bcoz i am having a logincheck usercontrol on that page that cheks wheither Session("UserID") is null or not.......

      As Good practice you should check user credentials in every page By creating a base which will check User Credentials in every Page LOad This Page need extend from System.Web.UI.Page and your all Page should extends this Page

      Thanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "

      D 1 Reply Last reply
      0
      • S Sandeep Akhare

        As per your comments When User clicks log out button you are clearing Session and redirecting user to Home Page this what you have implemented ... But it is behaving relatively against it

        Deepak Nigam wrote:

        But when i press logout button i come back to the last page.

        How are you going again back to last page ? If you saying by clicking back Button then Page might be coming from browser Cache

        Deepak Nigam wrote:

        bcoz i am having a logincheck usercontrol on that page that cheks wheither Session("UserID") is null or not.......

        As Good practice you should check user credentials in every page By creating a base which will check User Credentials in every Page LOad This Page need extend from System.Web.UI.Page and your all Page should extends this Page

        Thanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "

        D Offline
        D Offline
        Deepak Nigam
        wrote on last edited by
        #3

        I come back to last page by clicking the Back button on the browser.

        Deepak Nigam

        S 1 Reply Last reply
        0
        • D Deepak Nigam

          I come back to last page by clicking the Back button on the browser.

          Deepak Nigam

          S Offline
          S Offline
          Sandeep Akhare
          wrote on last edited by
          #4

          Deepak Nigam wrote:

          I come back to last page by clicking the Back button on the browser.

          This will come from Cache. If you are checking the Credentials in every page then this should not cause any problem. e.g If user is in My Application Page where there are many controls like buttons etc to retrive some data. Now if i click Sign Out from this Page I will get redirect to Home Page ok Its fine Now When user click back button browser will show My Application Page from Cache . Now if User clicks any server control in that page like button now Page Load will occure if you are checking Any user Credentials in My Application Page User wont be able to do anything he will get redirected to Home Page So its better to create a base class that will check user Credentials in its Page Load(What you are doing in user control) and your pages should extent this base page Any how if you don't want ot Cache your page you will have to write this lines Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.Cache.SetExpires(DateTime.Now); //or a date much earlier than current time Add at the every page

          Thanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "

          D 1 Reply Last reply
          0
          • S Sandeep Akhare

            Deepak Nigam wrote:

            I come back to last page by clicking the Back button on the browser.

            This will come from Cache. If you are checking the Credentials in every page then this should not cause any problem. e.g If user is in My Application Page where there are many controls like buttons etc to retrive some data. Now if i click Sign Out from this Page I will get redirect to Home Page ok Its fine Now When user click back button browser will show My Application Page from Cache . Now if User clicks any server control in that page like button now Page Load will occure if you are checking Any user Credentials in My Application Page User wont be able to do anything he will get redirected to Home Page So its better to create a base class that will check user Credentials in its Page Load(What you are doing in user control) and your pages should extent this base page Any how if you don't want ot Cache your page you will have to write this lines Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.Cache.SetExpires(DateTime.Now); //or a date much earlier than current time Add at the every page

            Thanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "

            D Offline
            D Offline
            Deepak Nigam
            wrote on last edited by
            #5

            Thanks Sandeep.......... It works.

            Deepak Nigam

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups