My application contains both "Umbraco" and "ASP.net web forms".
I am trying to configure routing in the Umbraco (with web forms) using "IRouteHandler".
If I use my ASP.net web forms the routing is working as it should.
But when I am trying to use "Umbraco" page the it throws exception message
"The file '~/TestPage.aspx' does not exist."
How many ways are there to fetch or get "Umbraco page" in GetHttpHandler method of IRouteHandler in ASP.net web forms ??
Below is my code snippet of Global class:
public class CustomGlobal : Umbraco.Web.UmbracoApplication { protected override void OnApplicationStarted(object sender, EventArgs e) { base.OnApplicationStarted(sender, e); RouteTable.Routes.Add( "RouteName", new Route("MyRoute/{Parameter}", new MyRouteHandler()) ); } }
Below
is the CodeSnippet of MyRouteHandler class which is inherited by
IRouteHandler
public class MyRouteHandler : IRouteHandler { public IHttpHandler GetHttpHandler(RequestContext requestContext) { var result = BuildManager.CreateInstanceFromVirtualPath("~/TestPage.aspx", typeof(Page)) as Page; return result; } }
public class MyRouteHandler : IRouteHandler
{
public IHttpHandler GetHttpHandler(RequestContext requestContext)
{
var result = BuildManager.CreateInstanceFromVirtualPath("~/TestPage.aspx") as Page;
return result;
}
}
Routing in Umbraco v6.0.5
Hello All...
I am working on Umbraco 6.0.5.
My application contains both "Umbraco" and "ASP.net web forms".
I am trying to configure routing in the Umbraco (with web forms) using "IRouteHandler".
If I use my ASP.net web forms the routing is working as it should.
But when I am trying to use "Umbraco" page the it throws exception message
"The file '~/TestPage.aspx' does not exist."
How many ways are there to fetch or get "Umbraco page" in GetHttpHandler method of IRouteHandler in ASP.net web forms ??
Below is my code snippet of Global class:
Below is the CodeSnippet of MyRouteHandler class which is inherited by IRouteHandler
Please advise
Thanks
Advay Pandya
Hi Advay,
Try below code.
public class MyRouteHandler : IRouteHandler { public IHttpHandler GetHttpHandler(RequestContext requestContext) { var result = BuildManager.CreateInstanceFromVirtualPath("~/TestPage.aspx") as Page; return result; } }
Regards,
Urvish
is working on a reply...