Redirecting to a link to a partial Post submission using ASP.NET MVC

I am looking for the best deal.

I have a ShoppingBag controller with Partial, which lists all the items in the user's bag. In this Partial, you can remove items from the bag via the message form.

A partial place on the main page that each of the views in the controller refers to. When an item is removed from the user's bag, I would like the user to be redirected to the original view. I am very pleased with how I achieved this with JavaScript, this is not JavaScript that I don’t understand about.

I have:

  • Detect link action with Request.UrlReferrer and redirect. This can be quite a time-consuming Action / Route discovery from a URL.
  • Pass the hidden field with the message. Not really keen on the idea of ​​bloating HTML.
  • Do not redirect to the sender, redirect to the confirmation page. Prefer to avoid if possible.
  • Something I missed.

Any help would be appreciated.

Rich

0
asp.net-mvc
Jun 30 '09 at 15:59
source share
1 answer

Definitely # 2. He does not swell, he expresses your intentions. It will be 50 bytes, don’t sweat, you still need to gzip'ing your HTTP.

However, make sure that you protect it in such a way that someone cannot put any old page there or on another site. Perhaps use an enumeration value if the number of outbound views is limited.

+6
Jul 03 '09 at 8:22
source share



All Articles