Web Forms - Session is not cleared - maybe?

Working on a new project that's web forms.

I log in, see whatever first page is and there's a log out button. I click "logout" and I get logged out and redirected to the login page. So far so good.

Now, I'm on the login page. I click the back button and I see the first page. I shouldn't tho. It's the user wasn't actually logged out.

Similar issue here but no solution Similar issue

I checked these

Web config

 <authentication mode="Forms">
      <forms name="DVAuth" path="/" loginUrl="user/login.aspx" protection="All" timeout="30" />
    </authentication>

    <authorization>
      <deny users="?" />
    </authorization>

Open in new window


Logout code looks like this

 protected void Page_Load( object sender, EventArgs e )
        {
            var userAccountVo = (UserAccountVO)Session["UserAccount"];
            var ssoLogoutUrl = GetSSOLogoutUrl(userAccountVo);

            // Put user code to initialize the page here
            Session["UserAccount"] = null;
            FormsAuthentication.SignOut();

            Response.Cookies.Remove( "DVAuth" );
            var c = new HttpCookie( "DVAuth" )
            {
                Expires = DateTime.Now.AddYears( -1 )
            };
            // c.Path = "/dvweb";
            Response.Cookies.Add( c );

            Session.Abandon();


            if ( !string.IsNullOrWhiteSpace( ssoLogoutUrl ))
                Response.Redirect( ssoLogoutUrl );
            else
                Response.Redirect( "~/user/login.aspx" );
        }

Open in new window


I did try Session.Clear() but I was still able to click back on the browser and get to the first page.

What else can I check?
LVL 8
CamilliaAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Kyle AbrahamsSenior .Net DeveloperCommented:
from: http://zeeshanumardotnet.blogspot.com/2010/06/how-do-disable-back-button-in-browser.html

you have to ensure the protected pages don't cache:
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetExpires(DateTime.UtcNow.AddHours(-1));
Response.Cache.SetNoStore();
Response.Cache.SetRevalidation(HttpCacheRevalidation.AllCaches);

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
CamilliaAuthor Commented:
Thanks, Kyle. Let me take a look.
0
CamilliaAuthor Commented:
worked, thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.