PrepAway - Latest Free Exam Questions & Answers

How should you implement the route handler?

DRAG DROP
You are developing an ASP.NET MVC application that takes customer orders.
Orders are restricted to customers with IP addresses based in the United States.
You need to implement a custom route handler.
How should you implement the route handler? (To answer, drag the appropriate line of code to the correct
location or locations. Each line of code may be used once, more than once, or not at all. You may need to drag
the split bar between panes or scroll to view content.)
Select and Place:

PrepAway - Latest Free Exam Questions & Answers

Answer:

Explanation:
Example:
This class implements IRouteHandler and has only one method “GetHttpHandler”. The main purpose of this
class is to return the instance of CustomHandler class. In the constructor, we are passing the RequestContext
to the handler.
{
public class CustomRouteHandler : IRouteHandler
{
public IHttpHandler GetHttpHandler(RequestContext requestContext)
{
return new CustomHandler(requestContext);
}}
http://msdn.microsoft.com/en-us/library/system.web.routing.iroutehandler.gethttphandler.aspx


Leave a Reply