I am using ASP .NET Webforms. I am registering the routes in Global.ascx. I have a route like this:
routes.Add("FormsRoutes", new System.Web.Routing.Route("Docs/", new FormsRouteHandler()));
the route handler is given below:
public class FormsRouteHandler : IRouteHandler
{
#region IRouteHandler Members
public IHttpHandler GetHttpHandler(RequestContext requestContext)
{
return BuildManager.CreateInstanceFromVirtualPath("~/Public/Forms.aspx", typeof(Page)) as Page;
}
#endregion
}
The problem that I am facing is: Forms.aspx spits out a list of forms (anchor links) that can be clicked. Since I have implemented routing it is coming as http://localhost/Docs/Forms/aaa.pdf and throwing an error that the particular resource is not found. I have all the files in Public/Forms folder. I am stuck and I dont know how to solve this problem. Any help is much appreciated.
Thanks in advance.