Registering the routes in the application startup:
routes.Add(new Route("favicon.ico", new StaticFileRouteHandler("~/Resources/images/favicon.ico")));
// generic, catch-all rule, caused the error for favicon.ico
routes.Add(Routes.BusinessObject, new Route(
string.Format("{{{0}}}", RouteParameters.BusinessObjectIdentifier),
new CustomRouteHandler("~/Pages/BusinessObjectDetails.aspx")));
The StaticFileRouteHandler to serve the the static file from the request.
public class StaticFileRouteHandler : IRouteHandler
{
public string VirtualPath { get; set; }
public StaticFileRouteHandler(string virtualPath)
{
VirtualPath = virtualPath;
}
#region IRouteHandler Members
public System.Web.IHttpHandler GetHttpHandler(RequestContext requestContext)
{
HttpContext.Current.RewritePath(VirtualPath);
return new DefaultHttpHandler();
}
#endregion
}
2 comments:
ICOs tremendous article, thank you for putting this collectively! this is obviously one allowable publicize. thanks for the important advice and insights you have as a end result furnished right here.
Please give to us visual representations of trademarks which attract your personal sense of style. online gokken vanaf 2021 legaal n nederland
Post a Comment