I saw how you can add custom routes to WebForms using this code.
public class WebFormsRouteHandler : IRouteHandler { public string VirtualPath { get; set; } public IHttpHandler GetHttpHandler(RequestContext requestContext) {
I am trying to get a similar job, but for web service files (TestService.asmx.) This previous method throws an exception because the page does not inherit from IHttpHandler. I saw other code that uses WebServiceHandlerFactory like this
return new WebServiceHandlerFactory().GetHandler(context, requestType, url, pathTranslated);
This returns an IHttpHandler as I need, but needs to pass an HttpContext to it, but the only thing I have is also part of RequestContext - this is HttpContextBase. From what I can say, I cannot convert it to an HttpContext.
Any ideas? Or maybe in a different way? What I'm trying to accomplish is to control the URLs for my web services through a regular routing system. For example, you want TestService.asmx to appear as ExampleTestService /.
source share