I have some code which show popup when submit button clicked
$(document).ready(function() {
....
@if (TempData.ContainsKey("TripUpdateSuccess"))
{
@:alertify.set({ delay: 3000 });
@:alertify.success("Transport " + @(Model.BookingID) + " has been updated.");
TempData.Remove("TripUpdateSuccess");
}
}
When user clicked save, submit occurs and this popup shows (alertify.js) Then user hits back button, and this popup shows again. Seems back button restores state of TempData object in ASP.NET MVC.
My task is not to show this popup when back button pressed. How this can be done ?
Forgot to say, submit redirects to this page, so this is why back button points to this page.
[HttpPost]
public ActionResult TripUpdate(TripUpdateModel model)
{
....
// pseudo code
if (ok)
TempData["TripUpdateSuccess"] = true;
else if (TempData.ContainsKey("TripUpdateSuccess"))
TempData.Remove("TripUpdateSuccess");
}