Question

I am adding functionality to a legacy web application such that in certain circumstances we will log the user off, returning them to a logon page that is separate to our application.

The application is part classic ASP, part ASP.NET and uses an external company-wide authentication mechanism.

We can achieve the desired effect (experimentally) by clearing session cookies in the browser and hitting the browser refresh button. The underlying authentication mechanism redirects the user to the logon page and when they enter their credentials they get directed back to the page they were originally on.

We are currently using the following approach...

function logoffUser() {
    $.cookie("ASP.NET_SessionId", null);
    $.cookie("ASPSESSIONKEY", null);
    $.cookie("CompanyFormsAuth", null);
    window.location.reload(true);
}

This works, insofar as the user gets bounced back to the external logon page. However the address shown in the browser address bar does not get updated, and when they logon they end up on our application's home page.

So the fundamental question is: Is there a JavaScript equivalent to hitting the browser refresh button?

Was it helpful?

Solution

This will "refresh" the current page

window.location = window.location;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top