I am creating a web-based messaging application in ASP.NET and am experiencing some problems while displaying an error message to the user if they go to send a message and something is wrong.
The user can view the profiles of people, and then click "send message". The following action is called (url is / message / create? To = username) and shows them a page on which they can enter their message and send it:
public ActionResult Create(string to) { ViewData["recipientUsername"] = to; return View(); }
On the displayed page, the username is entered into the hidden input field. When the user clicks Submit:
[AcceptVerbs(HttpVerbs.Post)] public ActionResult Create(FormCollection collection, string message) { try {
So now the error message is displayed to the user in order, however the URL has been changed in that it no longer has querystring (/ message / create). Again, this would be good, except that when the user clicks the refresh button, the page errors as the "Create" action no longer have the "to" parameter.
So, I assume that I need to somehow support my request. Is there a way to do this or do I need to use another method at all?
source share