routes .Add ("Detail",
new Route ("{maincategory}/{category}",
new RouteValueDictionary (new { controller = "Category", action = "Detail"}),
new RouteValueDictionary (new { category = new FromValuesListConstraint ("")}),
new MyRouteHandler ()));
routes.Add("Category",
new Route("{category}",
new RouteValueDictionary(new { controller = "Category", action = "Index", category = "" }),
new RouteValueDictionary(new { category = new FromValuesListConstraint("") }),
new MyRouteHandler()));
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = "" } // Parameter defaults
);
My routes are like this. But when I run the website Home page is displayed .After Home page is displayed something happens and again a new new quest is made ( I don't know why)I override the MvcRouteHandler and place a breakpoint in it.
public class MyRouteHandler : MvcRouteHandler
{
protected override IHttpHandler GetHttpHandler(RequestContext requestContext)
{
var url = HttpContext.Current.Request.RawUrl;
var route = requestContext.RouteData;
return new MvcHandler(requestContext);
}
}
url variable is /Content/Divider.gif. Because of that after the home page displayed the application gives error. I tried everything to understand the problem as a novice mvc user.But I couldn't find anything.
Thanks!