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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. Logout Problem in forms authentication

Logout Problem in forms authentication

Scheduled Pinned Locked Moved ASP.NET
questionasp-netsecurityhelp
16 Posts 3 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.
  • S SreejithAchutan

    How can i clear all cookies when we click on logout.

    K Offline
    K Offline
    kumar_k508
    wrote on last edited by
    #4

    Hi, 'clears formsauthentication cookies Response.Cookies.Remove(FormsAuthentication.FormsCookieName) 'clears all sessions variables of application Session.RemoveAll() Session.Abandon()

    S Kumar

    S 1 Reply Last reply
    0
    • K kumar_k508

      Hi, 'clears formsauthentication cookies Response.Cookies.Remove(FormsAuthentication.FormsCookieName) 'clears all sessions variables of application Session.RemoveAll() Session.Abandon()

      S Kumar

      S Offline
      S Offline
      SreejithAchutan
      wrote on last edited by
      #5

      Hi Friend, I Given the code but it willnot cleared the cookie and i can took all datas,it willnot ask again to login.

      K 1 Reply Last reply
      0
      • S SreejithAchutan

        Hi Friend, I Given the code but it willnot cleared the cookie and i can took all datas,it willnot ask again to login.

        K Offline
        K Offline
        kumar_k508
        wrote on last edited by
        #6

        HI, Are you redirecting from that page to some other page (generally login page) whenever page losses cookie value...?

        S Kumar

        S 1 Reply Last reply
        0
        • K kumar_k508

          HI, Are you redirecting from that page to some other page (generally login page) whenever page losses cookie value...?

          S Kumar

          S Offline
          S Offline
          SreejithAchutan
          wrote on last edited by
          #7

          Hi, Actually i put a login control in masterpage enabled page and i put menu in masterpage.in the menu i put a menuitem logout and in the menu item click event i given formsauthentication.signout and the above given code.and i retdirect the page to home page where the login control, is situated.This is the flow of login and logout.After logout i checked username is null or not in another menuitem page.but i can easily access the page because the username still exists.What is the problem.

          K 1 Reply Last reply
          0
          • S SreejithAchutan

            Hi Friends, i have used aspnet authentication to logging into my site.When i click logout and i click back button,i can see the last page.How can i logout properly.I used FormsAuthentication.Signout() to logout.What is the problem of dont properly logout fro site.

            K Offline
            K Offline
            kumar_k508
            wrote on last edited by
            #8

            Hi, you can do like this also ...just by using javascript you can disable back button (but this is not good practice).... ;)

            S Kumar

            S 1 Reply Last reply
            0
            • S SreejithAchutan

              Hi, Actually i put a login control in masterpage enabled page and i put menu in masterpage.in the menu i put a menuitem logout and in the menu item click event i given formsauthentication.signout and the above given code.and i retdirect the page to home page where the login control, is situated.This is the flow of login and logout.After logout i checked username is null or not in another menuitem page.but i can easily access the page because the username still exists.What is the problem.

              K Offline
              K Offline
              kumar_k508
              wrote on last edited by
              #9

              HI, you can check the formsauthentication cookie information in the masterpage's page_load event.. if the cookies value is nothing simply redirect to login page

              1 Reply Last reply
              0
              • K kumar_k508

                Hi, you can do like this also ...just by using javascript you can disable back button (but this is not good practice).... ;)

                S Kumar

                S Offline
                S Offline
                SreejithAchutan
                wrote on last edited by
                #10

                Not when i click the back button when i click any menu link also i can easily access the datas without logged in.

                K 2 Replies Last reply
                0
                • S SreejithAchutan

                  Hi Friends, i have used aspnet authentication to logging into my site.When i click logout and i click back button,i can see the last page.How can i logout properly.I used FormsAuthentication.Signout() to logout.What is the problem of dont properly logout fro site.

                  R Offline
                  R Offline
                  rakeshs312
                  wrote on last edited by
                  #11

                  Hi, In your first page, paste this code in pageload

                  Response.Cache.SetExpires(DateTime.UtcNow.AddMinutes(-1));
                  Response.Cache.SetCacheability(HttpCacheability.NoCache);
                  Response.Cache.SetNoStore();

                  S 1 Reply Last reply
                  0
                  • S SreejithAchutan

                    Not when i click the back button when i click any menu link also i can easily access the datas without logged in.

                    K Offline
                    K Offline
                    kumar_k508
                    wrote on last edited by
                    #12

                    hi, what are modifications that you are done?

                    S Kumar

                    1 Reply Last reply
                    0
                    • S SreejithAchutan

                      Not when i click the back button when i click any menu link also i can easily access the datas without logged in.

                      K Offline
                      K Offline
                      kumar_k508
                      wrote on last edited by
                      #13

                      Hi, just check the cookie information is either available or not in master page's page load event,if values are nothing just redirect to login page...

                      S Kumar

                      1 Reply Last reply
                      0
                      • R rakeshs312

                        Hi, In your first page, paste this code in pageload

                        Response.Cache.SetExpires(DateTime.UtcNow.AddMinutes(-1));
                        Response.Cache.SetCacheability(HttpCacheability.NoCache);
                        Response.Cache.SetNoStore();

                        S Offline
                        S Offline
                        SreejithAchutan
                        wrote on last edited by
                        #14

                        Sorry to say again it works wrongly.the user can access pages after paster the page in pageload of first page.

                        S 1 Reply Last reply
                        0
                        • S SreejithAchutan

                          Sorry to say again it works wrongly.the user can access pages after paster the page in pageload of first page.

                          S Offline
                          S Offline
                          SreejithAchutan
                          wrote on last edited by
                          #15

                          Hi Kumar Sir, I got it sir.Actually we have to given Formsauthentication.LoginUrl then it cleanely works.

                          S 1 Reply Last reply
                          0
                          • S SreejithAchutan

                            Hi Kumar Sir, I got it sir.Actually we have to given Formsauthentication.LoginUrl then it cleanely works.

                            S Offline
                            S Offline
                            SreejithAchutan
                            wrote on last edited by
                            #16

                            Thanks for your corordination sir...

                            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