Cristian Boariu
Cristian Boariu

Reputation: 9621

Post a request with a form to an asp.net mvc route

A third party site will do a request containing a form to this route (I will load its content like xd.LoadXml(Request.Form["basket"]);):

www.mysite.com/iPaperCheckout

Can you please tell me where I am wrong because it's telling me:

    The resource cannot be found.
Requested URL: /iPaperCheckout

I've registered my route for POST:

routes.MapLocalizedRoute("ShoppingCartIPaper",
                        "iPaperCheckout",
                        new { controller = "ShoppingCart", action = "IPaperCheckout" },
                        new { httpMethod = new HttpMethodConstraint("POST") },
                        new[] { "Nop.Web.Controllers" });

I also added it in ShoppingCartController:

    [ValidateInput(false)]
    [HttpPost, ActionName("IPaperCheckout")]
    [FormValueRequired("basket")]
    public ActionResult IPaperCheckout(FormCollection form)
    {
         //code
     }

Do you see anything wrong from my side?

Upvotes: 0

Views: 657

Answers (1)

Akos Lukacs
Akos Lukacs

Reputation: 2047

Shouldn't the url be something like www.mysite.com/PaperCheckoutApp/iPaperCheckout?

Using normal IIS + MVC conventions, www.mysite.com/iPaperCheckout would mean that the request is handled by an application called iPaperCheckout, and the application relative URL is an empty string. So by default the request would be handled by Home controller / Index action, if you have the defaults in you route map.

So I would guess, that your application isn't running where you expect it to run. Do you run it under full IIS? Have you created the application properly? Is the application pool (.NET4 required if you running MVC3) running?

Upvotes: 1

Related Questions