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. ASP.Net Logout issue

ASP.Net Logout issue

Scheduled Pinned Locked Moved ASP.NET
helpcsharpasp-nettutorialquestion
5 Posts 5 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.
  • B Offline
    B Offline
    berba
    wrote on last edited by
    #1

    Hi, Having some problems when clicking on the logout button. After logging out when the user click the back button on the Internet explorer browser, he is redirected to the application. I've tried to add the following codes Response.Expires = 0 Response.Cache.SetNoStore() Response.AppendHeader("Pragma", "no-cache") This works fine but when a form is submitted and the user clicks on the ie back button, he gets webpage expired. He has to click the refresh button to reload the page. Any idea how to solve the logout problem?? Cheers Berba

    K T T A 4 Replies Last reply
    0
    • B berba

      Hi, Having some problems when clicking on the logout button. After logging out when the user click the back button on the Internet explorer browser, he is redirected to the application. I've tried to add the following codes Response.Expires = 0 Response.Cache.SetNoStore() Response.AppendHeader("Pragma", "no-cache") This works fine but when a form is submitted and the user clicks on the ie back button, he gets webpage expired. He has to click the refresh button to reload the page. Any idea how to solve the logout problem?? Cheers Berba

      K Offline
      K Offline
      keyur satyadev
      wrote on last edited by
      #2

      Well, you can just check on page load that if user is logged in then display the page. Otherwise redirect to login page or display alert message that please login. There is no requirement of Response.Expires = 0 Response.Cache.SetNoStore() Response.AppendHeader("Pragma", "no-cache") Let me know if you have any doubts. thank you.

      Regards Keyur Satyadev

      1 Reply Last reply
      0
      • B berba

        Hi, Having some problems when clicking on the logout button. After logging out when the user click the back button on the Internet explorer browser, he is redirected to the application. I've tried to add the following codes Response.Expires = 0 Response.Cache.SetNoStore() Response.AppendHeader("Pragma", "no-cache") This works fine but when a form is submitted and the user clicks on the ie back button, he gets webpage expired. He has to click the refresh button to reload the page. Any idea how to solve the logout problem?? Cheers Berba

        T Offline
        T Offline
        taha bahraminezhad Jooneghani
        wrote on last edited by
        #3

        when the users log on set a session for your users, and check session in target pages, and when user log out just remove that session!

        Session.Add("userID",ID);
        Session.Remove("userID");

        for checking session:

        if(Session["user"]!=null)
        {
        //do your works
        }
        else
        {
        Response.Redirect("default.aspx");
        }

        1 Reply Last reply
        0
        • B berba

          Hi, Having some problems when clicking on the logout button. After logging out when the user click the back button on the Internet explorer browser, he is redirected to the application. I've tried to add the following codes Response.Expires = 0 Response.Cache.SetNoStore() Response.AppendHeader("Pragma", "no-cache") This works fine but when a form is submitted and the user clicks on the ie back button, he gets webpage expired. He has to click the refresh button to reload the page. Any idea how to solve the logout problem?? Cheers Berba

          T Offline
          T Offline
          thatraja
          wrote on last edited by
          #4

          Check this Tip/Trick Browser back button issue after logout[^]

          thatraja

          FREE Code Conversion VB6 ASP VB.NET C# ASP.NET C++ JAVA PHP DELPHI ColdFusion
          HTML Marquee & its alternatives

          Nobody remains a virgin, Life screws everyone :sigh:

          1 Reply Last reply
          0
          • B berba

            Hi, Having some problems when clicking on the logout button. After logging out when the user click the back button on the Internet explorer browser, he is redirected to the application. I've tried to add the following codes Response.Expires = 0 Response.Cache.SetNoStore() Response.AppendHeader("Pragma", "no-cache") This works fine but when a form is submitted and the user clicks on the ie back button, he gets webpage expired. He has to click the refresh button to reload the page. Any idea how to solve the logout problem?? Cheers Berba

            A Offline
            A Offline
            august_star
            wrote on last edited by
            #5

            Try this - Logout button event:

            String pageUrl = "";
            pageUrl = Request.Url.ToString();
            Session.Abandon();
            Response.Redirect(pageUrl);

            - And in other page that need session to work try

            protected void Page_Init(object sender, EventArgs e)
            {
            Response.Cache.SetNoServerCaching();
            Response.Cache.SetCacheability(HttpCacheability.NoCache);
            Response.Cache.SetNoStore();
            Response.Cache.SetExpires(new DateTime(1900, 01, 01, 00, 00, 00, 00));
            }

            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