When a user visits my site, each page has a "Login" link. By clicking on this, you use JavaScript to display the overlay window where the user is prompted for credentials. After entering these credentials on the web server, an Ajax call is called to verify them; if they are valid, the authentication cookie is sent back and the page reloads so that the content on the page that is specific to the authenticated users or the current user (now) is displayed.
I am reloading the page through a script using:
window.location.reload();
This works great for pages loaded via a GET request (the vast majority), but postback forms are used on some pages. Therefore, if the user goes to one of these pages, performs a postback, and then selects the login when the window.location.reload() script is started, they ask for a dialog box asking if they want to resend the POST body.

I was thinking of getting around this, I could just tell the browser to reload the page, so I tried:
window.location.href = window.location.href;
But the browser does not take any action with the above statement, I suppose, because it thinks the new URL is the same as the old one. If I change the above, follow these steps:
window.location.href = window.location.pathname;
It reloads the page, but I am losing any request parameters.
My current workaround is enough, but not really - in short, I bind the querystring parameter to the current window.location.href value and then assign it back to window.location.href by calling reloadPage("justLoggedIn") , where the reloadPage function is:
function reloadPage(querystringTackon) { var currentUrl = window.location.href; if (querystringTackon != null && querystringTackon.length > 0 && currentUrl.indexOf(querystringTackon) < 0) { if (currentUrl.indexOf("?") < 0) currentUrl += "?" + querystringTackon; else currentUrl += "&" + querystringTackon; } window.location.href = currentUrl; }
This works, but it leads to the URL www.example.com/SomeFolder/SomePage.aspx?justLoggedIn , which seems sticky.
Is there a way in JavaScript to get it to restart the GET and not ask the user to re-send the POST data? I need to make sure that any existing query parameters are not lost.