i need to check whether the user clicking the browser Refresh button and redirect to error page. Can we do this in javascript or any server side methods in ASP.net
i need to check whether the user clicking the browser Refresh button and redirect
Share
If you give each link you present a unique ID (e.g. a GUID) in the URL as a parameter, then you can keep track of all the requests you’ve processed. (You could clear out ‘old’ requests if you don’t mind the mechanism not working if someone leaves a browser open for a few days and then hitting refresh.) The first time you see a GUID, write it into the table. If you see it again, redirect to an error page.
It’s pretty ugly though, and users could just edit the URL to change the GUID slightly. (You could fix this last flaw by recording the GUID when you generate it, and update the table to indicate when it’s been used.)
In general, users expect to be able to refresh the page though – particularly for GET requests (even though most users wouldn’t know what that means). Why do you want to do this?