make action method only accessible through redirect
asp.net, asp.net-mvc-3
Solution
Set a value in `TempData` before the redirect. In the `MessageSaved` action method, check for that value before showing the form. Otherwise, redirect to another page.
Problem
I'm trying to submit a form. When the form is submitted I want the form to dissapear and the text `Thanks for your support. An e-mail will be sent to you as soon as possible.` to show. I think the most logical way to go by this is by making the form submit to the action `SaveMessage()` that redirects to the action `RedirectToAction("MessageSaved")` that returns the view with the message. If it isn't, please say so. This is for practice. The problem is that the message can be viewed as well by going to `/Support/MessageSaved`. How do I prevent users from accessing it by url, but make the action accessible by `redirectToAction()`?