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. Log Out issue

Log Out issue

Scheduled Pinned Locked Moved ASP.NET
help
6 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.
  • N Offline
    N Offline
    nitin_ion
    wrote on last edited by
    #1

    i have implemented this code on the logout button FormsAuthentication.SignOut(); Session.Abandon(); Response.ExpiresAbsolute = DateTime.Now.AddDays(-1d); Response.Expires = -1500; Response.CacheControl = "no-cache"; Response.Redirect("~/frm_default.aspx"); but when i click on back button i am able to go the previous page.

    Y D A S 4 Replies Last reply
    0
    • N nitin_ion

      i have implemented this code on the logout button FormsAuthentication.SignOut(); Session.Abandon(); Response.ExpiresAbsolute = DateTime.Now.AddDays(-1d); Response.Expires = -1500; Response.CacheControl = "no-cache"; Response.Redirect("~/frm_default.aspx"); but when i click on back button i am able to go the previous page.

      Y Offline
      Y Offline
      Yaazi
      wrote on last edited by
      #2

      i think u have to add Headers to restrict Back view Try this Response.CacheControl = "no-store"; Response.AddHeader("Pragma", "no-cache"); Response.AppendHeader("Cache-Control", "no-store");

      1 Reply Last reply
      0
      • N nitin_ion

        i have implemented this code on the logout button FormsAuthentication.SignOut(); Session.Abandon(); Response.ExpiresAbsolute = DateTime.Now.AddDays(-1d); Response.Expires = -1500; Response.CacheControl = "no-cache"; Response.Redirect("~/frm_default.aspx"); but when i click on back button i am able to go the previous page.

        D Offline
        D Offline
        dotnetmember
        wrote on last edited by
        #3

        if u r using master pages, code this in page load of master page or in page load of everypage Response.Expires = 60; DateTime now = DateTime.Now.AddMilliseconds(-1); Response.ExpiresAbsolute = now; Response.AddHeader("pragma", "no-cache"); int timeout = (Session.Timeout + 1) * 60; Response.AddHeader("Refresh", timeout.ToString()); Response.AddHeader("cache-control", "private"); Response.CacheControl = "no-cache"; if (Session.IsNewSession) { Response.Redirect("~/Default.aspx"); } and in logout Session.Abandon();

        N 1 Reply Last reply
        0
        • D dotnetmember

          if u r using master pages, code this in page load of master page or in page load of everypage Response.Expires = 60; DateTime now = DateTime.Now.AddMilliseconds(-1); Response.ExpiresAbsolute = now; Response.AddHeader("pragma", "no-cache"); int timeout = (Session.Timeout + 1) * 60; Response.AddHeader("Refresh", timeout.ToString()); Response.AddHeader("cache-control", "private"); Response.CacheControl = "no-cache"; if (Session.IsNewSession) { Response.Redirect("~/Default.aspx"); } and in logout Session.Abandon();

          N Offline
          N Offline
          nitin_ion
          wrote on last edited by
          #4

          This is fine but then when i am on a page (not logged out) and then i click back button it does not take me to the previuos page. ihave to click refresh to get the page.

          1 Reply Last reply
          0
          • N nitin_ion

            i have implemented this code on the logout button FormsAuthentication.SignOut(); Session.Abandon(); Response.ExpiresAbsolute = DateTime.Now.AddDays(-1d); Response.Expires = -1500; Response.CacheControl = "no-cache"; Response.Redirect("~/frm_default.aspx"); but when i click on back button i am able to go the previous page.

            A Offline
            A Offline
            Abhishek Sur
            wrote on last edited by
            #5

            browser cache always remains open.. you cant erase bowser cache programmatically. Only you can do, is when user clicks anything on a page after logoff, throw some error messages.

            Abhishek Sur My Latest Articles Basics on LINQ and Lambda Expressions
            Create .NET Templates

            1 Reply Last reply
            0
            • N nitin_ion

              i have implemented this code on the logout button FormsAuthentication.SignOut(); Session.Abandon(); Response.ExpiresAbsolute = DateTime.Now.AddDays(-1d); Response.Expires = -1500; Response.CacheControl = "no-cache"; Response.Redirect("~/frm_default.aspx"); but when i click on back button i am able to go the previous page.

              S Offline
              S Offline
              specialdreamsin
              wrote on last edited by
              #6

              Hi, On the Page Load write if Session("UserId")="" then             Response.Redirect("Login.aspx") end if if you click back now, the page will execute the page load na...it will go to login page. Ramesh Sambari

              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