asp.net mvc routing id parameter

Posted by parminder on Stack Overflow See other posts from Stack Overflow or by parminder
Published on 2010-04-30T08:30:54Z Indexed on 2010/04/30 8:37 UTC
Read the original article Hit count: 368

Filed under:
|
|

Hi Experts,

I am working on a website in asp.net mvc. I have a route

routes.MapRoute(

                    "Default", // Route name
                    "{controller}/{action}/{id}", // URL with parameters
                    new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults

                );

which is the default route. Now I have method

public ActionResult ErrorPage(int errorno)

    {
        return View();
    }

now if i want to run this code with http://something/mycontroller/Errorpage/1 it doesnt work. but if i change the parameter name to id from errorno it works.

Is it cumpulsory to have same parameter name for this method. Or I need to create seperate routes for such situations.

Regards Parminder

© Stack Overflow or respective owner

Related posts about asp.net-mvc

Related posts about routing