Use the routing engine for form submissions in ASP.NET MVC Preview 4?

Solution: public ActionResult TestAction(string paramName) { if (!String. IsNullOrEmpty(Request"paramName")) { return RedirectToAction("TestAction", new { paramName = Request"paramName"}); } /* ... */ }.

In your route, get rid of the {paramName} part of the URL. It should be: TestController. Mvc/TestAction As that is the URL you want the request to route to.

Your form will then post to that URL. Posted form values are mapped to parameters of an action method automatically, so don't worry about not having that data passed to your action method.

My understanding is that this is how HTML works. If you do a and post the form, then the form will post foo? Param1=value1&...¶mn=valuen.It has nothing to do with MVC.

Besides, what part of REST does that URL violate? It's not a "pretty" URL, but by strict definition of REST, it can be RESTful. REST doesn't specify that query parameters have to be in an URL segment.

And in this case, those are query parameters.

1 Yeah you're right - thanks. Reflecting on this I'm not even sure what I was thinking - maybe just to get the MVC app to route to a nice new URL after form submission. The later GET/POST attributes help things.

– Graphain Feb 27 '09 at 13:21.

It has nothing to do with MVC. Besides, what part of REST does that URL violate? It's not a "pretty" URL, but by strict definition of REST, it can be RESTful.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions