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. Implementing logout functionality for web application

Implementing logout functionality for web application

Scheduled Pinned Locked Moved ASP.NET
help
18 Posts 6 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.
  • V Vishnu Nath

    Abhijit Jana wrote:

    if(Session["UserID"] != null) { //Do Operation } else { Response.Redirect("Login.aspx"); }

    This is only valid if a session for that variable was created and you are checking for its value. But if someone requests this page directly, it will throw an error stating Object refrence not set.

    Aspiring Techie, Vishnu Nath

    A Offline
    A Offline
    Abhijit Jana
    wrote on last edited by
    #9

    Please read this : Exploring Session in ASP.Net[^]

    Abhijit Jana | Codeproject MVP Web Site : abhijitjana.net Visit My Latest Article : Beginner's Guide : Exploring IIS 6.0 With ASP.NET

    1 Reply Last reply
    0
    • V Vishnu Nath

      Abhijit Jana wrote:

      if(Session["UserID"] != null) { //Do Operation } else { Response.Redirect("Login.aspx"); }

      This is only valid if a session for that variable was created and you are checking for its value. But if someone requests this page directly, it will throw an error stating Object refrence not set.

      Aspiring Techie, Vishnu Nath

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #10

      Buy a really basic book and read it. The code is CHECKING if the value is null.

      Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

      V 1 Reply Last reply
      0
      • C Christian Graus

        Buy a really basic book and read it. The code is CHECKING if the value is null.

        Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

        V Offline
        V Offline
        Vishnu Nath
        wrote on last edited by
        #11

        Thanx for your suggestion and advice, will surely do the same. I have implemented my own logic on it. :)

        Aspiring Techie, Vishnu Nath

        A A 2 Replies Last reply
        0
        • V Vishnu Nath

          Thanx for your suggestion and advice, will surely do the same. I have implemented my own logic on it. :)

          Aspiring Techie, Vishnu Nath

          A Offline
          A Offline
          Anuj Banka
          wrote on last edited by
          #12

          What logic u applied.Beacuse back button take page from cache.so it take old session value. so to avoid this wat u did? I also want to know

          V 1 Reply Last reply
          0
          • V Vishnu Nath

            Thanx for your suggestion and advice, will surely do the same. I have implemented my own logic on it. :)

            Aspiring Techie, Vishnu Nath

            A Offline
            A Offline
            Abhijit Jana
            wrote on last edited by
            #13

            What was the Wrong with CG's Answer ?

            Abhijit Jana | Codeproject MVP Web Site : abhijitjana.net Visit My Latest Article : Beginner's Guide : Exploring IIS 6.0 With ASP.NET

            V A 2 Replies Last reply
            0
            • A Abhijit Jana

              What was the Wrong with CG's Answer ?

              Abhijit Jana | Codeproject MVP Web Site : abhijitjana.net Visit My Latest Article : Beginner's Guide : Exploring IIS 6.0 With ASP.NET

              V Offline
              V Offline
              Vishnu Nath
              wrote on last edited by
              #14

              No he wasn't wrong. I had a bit concern, if a user tries to access the page directly, without following the normal routine, then the session variable which i would be checking on my page, would never have existed. Hence i put out a check over there nd followed with the rest of the suggestions provided by all of u.

              Aspiring Techie, Vishnu Nath

              1 Reply Last reply
              0
              • A Anuj Banka

                What logic u applied.Beacuse back button take page from cache.so it take old session value. so to avoid this wat u did? I also want to know

                V Offline
                V Offline
                Vishnu Nath
                wrote on last edited by
                #15

                U r right. And to stop a user accessing a page even after logout, i simply disabled the browsers back button after logout through javascript.

                Aspiring Techie, Vishnu Nath

                A 1 Reply Last reply
                0
                • Y Yonathan1111

                  Make all the session variables null before logout.

                  modified on Thursday, October 8, 2009 4:04 AM

                  V Offline
                  V Offline
                  Vishnu Nath
                  wrote on last edited by
                  #16

                  Thanks for everyone's active participation in helping me. :)

                  Aspiring Techie, Vishnu Nath

                  1 Reply Last reply
                  0
                  • V Vishnu Nath

                    U r right. And to stop a user accessing a page even after logout, i simply disabled the browsers back button after logout through javascript.

                    Aspiring Techie, Vishnu Nath

                    A Offline
                    A Offline
                    Anuj Banka
                    wrote on last edited by
                    #17

                    U means u disable ur back button in ur whole project.

                    1 Reply Last reply
                    0
                    • A Abhijit Jana

                      What was the Wrong with CG's Answer ?

                      Abhijit Jana | Codeproject MVP Web Site : abhijitjana.net Visit My Latest Article : Beginner's Guide : Exploring IIS 6.0 With ASP.NET

                      A Offline
                      A Offline
                      Anuj Banka
                      wrote on last edited by
                      #18

                      cgs ans not wrong but if we hav secure page in our site. user can view secure information

                      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