I have my page's url like:
http://www.ab.com/test.aspx?invitationID=XXXX
I check in my Page_Load whether the invitation is really valid:
if(!IsPostback)
{
//login for validation. If not valid invitationID do a server.Transfer to 404 page
}
This works well. However once user clicks on Submit button on registration page. He is redirected to RegistrationSuccessful page. It works well till here. But now, if he presses browser's back button due to the cache he again sees the page and he can register again. This is a bug.
I did add:
HttpContext.Current.Response.Cache.SetExpires(DateTime.UtcNow.AddMinutes(-1));
HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache);
HttpContext.Current.Response.Cache.SetNoStore();
in my Page_Load and it seems to work fine. However, do you guys see any security threat with this approach? Is the validation logic for invitation in !IsPostback
correct or should I do it regardless of whether it is postback or not?