0

I have one scenario where user submit one form. After submit form it redirect to the confirmation page. I need here that when user refresh url or press Ctrl+f5 or press F5 or click on browser refresh button this page again redirect to the previous form page where submission has happend. I tried this code:

<meta http-equiv="refresh" content="0; url=http://example.com/" />
but it is redirecting without refresh url. Need Help
Vikash
  • 340
  • 1
  • 5
  • 24

1 Answers1

0

The code above will simply redirect to "http://example.com/" whenever the confirmation page is loaded. See this:

Redirect from an HTML page

What you can do is save some count in Session and increment it when the confirmation page loads. Then check if its 1 return the confirmation page view if its >1 which will be the case if someone refreshes it. In that case you can redirect to form page.

Community
  • 1
  • 1
  • Hi Hamza, Currently i am not using any session. I need here in anytime on confirmation page it should redirect to the form page. if it can be possbile through jquery also that would b e good for me. – Vikash Jan 21 '17 at 11:36
  • Have u tried using "TempData" to save the counter because TempData values also persist the redirects as apposed to ViewData or ViewBag? – Hamza Saleem Jan 21 '17 at 15:20
  • currently i am using asp.net not mvc – Vikash Jan 23 '17 at 07:36