Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET
You are implementing an ASP.NET MVC 2 Web application.
The URL with path /Home/Details/{country} will return a page that provides information about the named
country.
You need to ensure that requests for this URL that contain an unrecognized country value will not be
processed by the Details action of HomeController.
What should you do?
A. Add the ValidateAntiForgeryToken attribute to the Details action method.
B. Add the Bind attribute to the country parameter of the Details action method. Set the attribute's Prefix
property to Country.
C. Create a class that implements the IRouteConstraint interface. Configure the default route to use this
class.
D. Create a class that implements the IRouteHandler interface. Configure the default route to use this class.
Posted 9-Jan-13 23:27pm
Tejal S1.9K
Comments
Suvabrata Roy at 10-Jan-13 5:56am
   
C. would be a better idea (IRouteConstraint )

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

C. Create a class that implements the IRouteConstraint interface. Configure the default route to use this class.
Looks like a good option. B too is an option but more of a workaround.
Details: MSDN: IRouteConstraint Interface[^]
  Permalink  
Comments
Shona22 at 11-Jan-13 0:33am
   
Thank you :)
Sandeep Mewara at 11-Jan-13 1:19am
   
Welcome.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 325
1 DamithSL 300
2 Sergey Alexandrovich Kryukov 289
3 CPallini 235
4 Maciej Los 215
0 OriginalGriff 5,455
1 DamithSL 4,422
2 Maciej Los 3,860
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,010


Advertise | Privacy | Mobile
Web03 | 2.8.141216.1 | Last Updated 10 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100