Blogger :
ASP.NET Team Blogs
All posts :
All posts by ASP.NET Team Blogs
Category :
ASP.NET
Blogged date : 2008 Aug 07
In this tip, I show how you can create custom route constraints that prevent you from accessing a URL unless you are local and authenticated. I show you how you can create a LocalConstraint and an AuthenticatedConstraint. I also demonstrate how you can test your custom constraints. When you create an MVC route, you can add constraints to a route. For example, the following route maps browser requests to a controller named Blog and an action named Archive: routes.MapRoute( "BlogArchive", "Archive/{entryDate}", new { controller = "Blog", action = "Archive" } ); This route, named BlogArchive, maps three parameters. The controller parameter is assigned the value Blog and the action parameter is assigned the...(
read more)