09-16-2023, 10:43 PM
(This post was last modified: 09-16-2023, 10:48 PM by Alexandre Machado.)
Hi Jeoren,
I recreated the 404 status here when restablishing the connection (and creating a new session).
This happens because the browser will repost all the fields from the first request when resubmiting the page (creating a new POST request) when you do
It happens that IW has a built-in safety check to avoid creating sessions when the request doesn't look correct. In this case, the initial request was repeated by the browser, but the server doesn't recognize the session (I'm considering that the server has been restarted, for instance, so it has no recollection of the initial session).
When this safety check fails, IW will respond with a 404, and that's what you got.
When you configured the applicationt o use the Post/Redirect/Get mechanism, the POST request is followed by a GET. So, when reloading the browser will actually send a GET request, instead of a POST and the safety check above doesn't fail, so the session starts.
A better way to reload the page is using this code in your monitorCalled() function:
This will actually "renavigate" to the same URL, so the browser will not re-POST the old parameters back. In practice it works like you were typing it yourself in the browser address bar.
There is another option that also works:
So, in short you can either:
a) Keep the PRG pattern and use the window.location.reload() method
b) Disable the PRG pattern and load it using the modified code above
I believe your changes in IWCommon.js are safe and we are going to implement that as well.
Cheers,
I recreated the 404 status here when restablishing the connection (and creating a new session).
This happens because the browser will repost all the fields from the first request when resubmiting the page (creating a new POST request) when you do
Code:
window.location.reload();It happens that IW has a built-in safety check to avoid creating sessions when the request doesn't look correct. In this case, the initial request was repeated by the browser, but the server doesn't recognize the session (I'm considering that the server has been restarted, for instance, so it has no recollection of the initial session).
When this safety check fails, IW will respond with a 404, and that's what you got.
When you configured the applicationt o use the Post/Redirect/Get mechanism, the POST request is followed by a GET. So, when reloading the browser will actually send a GET request, instead of a POST and the safety check above doesn't fail, so the session starts.
A better way to reload the page is using this code in your monitorCalled() function:
Code:
window.location = window.location.href;This will actually "renavigate" to the same URL, so the browser will not re-POST the old parameters back. In practice it works like you were typing it yourself in the browser address bar.
There is another option that also works:
Code:
window.location.assign(document.URL);So, in short you can either:
a) Keep the PRG pattern and use the window.location.reload() method
b) Disable the PRG pattern and load it using the modified code above
I believe your changes in IWCommon.js are safe and we are going to implement that as well.
Cheers,

