Ben Biddington

Whatever it is, it's not about "coding"

Configuring routes in ASP.NET MVC

leave a comment »

Routes can be configured as follows:

routes.Add(
    new Route(
        "files/{id}",                        // URL pattern
        new RouteValueDictionary    // Defaults
        {
            { "controller"  , "file"},      // Default controller is file
            { "action"      , "index"},
            { "id"          , null}
        },
        new MvcRouteHandler()
    )
);

Which means an URL like:

/files/12345

returns the file with id equal to 12345.

Advertisements

Written by benbiddington

8 October, 2008 at 08:31

Posted in Uncategorized

Tagged with , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: