PrepAway - Latest Free Exam Questions & Answers

Which code segment should you add?

You are developing an ASP.NET MVC 2 Web Application that displays daily blog posts. Visitors access
a blog post page by using a Web address to pass in the year, month, and day -for
example,contoso.com/2010/07/20. The application must register the appropriate route to use the
Display action of the blog controller. Only page visits with a four digit year, two-digit month and twodigit dat can be passed to the action.You need to ensure that the route is registered correctly. Which
code segment should you add?

PrepAway - Latest Free Exam Questions & Answers

A.
routes.MapRoute(“DailyBlogPosts”, “{year}/{month}/{day}”,
new {
controller=”Blog”,
action=”Display”,
year=@”\d{4}”,
month=@”\d{2}”,
day=@”\d{2}”
});

B.
routes.MapRoute(“DailyBlogPosts”, “{year}/{month}/{day}”,
new {
controller=”Blog”,
action=”Display”,
}
new {
year=@”\d{4}”,
month=@”\d{2}”,
day=@”\d{2}”
});

C.
routes.MapRoute(“DailyBlogPosts”, “{year}/{month}/{day}”,
new {
controller=”Blog”,
action=”Display”,

}
new {
year=”yyyy”,
month=”mm”,
day=”dd”
});

D.
routes.MapRoute(“DailyBlogPosts”, “{year}/{month}/{day}”,
new {
controller=”Blog”,
action=”Display”,
year=”yyyy”,
month=”mm”,
day=”dd”
});


Leave a Reply