Your controller value shouldn't include 'Controller'. So it should be...
RouteTable.Routes.MapRoute(
"SomeName",
"Login/index",
new
{
controller = "Login",
action = "Index",
id = UrlParameter.Optional
});
I've actually never used the ApplicationEventHandler method to hijack routes. I should try it.
If you continue to have trouble, you could try creating a class in your project root that inherits the WebBootManager to hijack routing. This is the way I learned and it has worked for me. An example of that would be:
namespace Example.Web
{
public class ExampleApplication : UmbracoApplication
{
protected override IBootManager GetBootManager()
{
return new ExampleBootManager(this);
}
protected override void OnApplicationStarting(object sender, EventArgs e)
{
BundleConfig.RegisterBundles(BundleTable.Bundles);
}
}
class ExampleBootManager : WebBootManager
{
public ExampleBootManager(UmbracoApplication umbracoApplication) : base(umbracoApplication) { }
public override IBootManager Complete(Action<ApplicationContext> afterComplete)
{
RouteTable.Routes.MapRoute(
"Home",
"home/index",
new { controller = "Home", action = "Index" }
);
return base.Complete(afterComplete);
}
}
}
Hope this helps. I'm sure someone more knowledgeable than myself will chime in.
no physical template file was found for template
Hi, I have just created my own controller in existing Umbraco website. My controller is below :
LoginController
View (Views/Login/Index.cshtml)
And I have also added a class to register custom routes:
RouteHandler.cs
But when I try to access page using http://Localhost/Login/Index
I get error message
no physical template file was found for template ..
Any help.
Thanks
Your controller value shouldn't include 'Controller'. So it should be...
I've actually never used the ApplicationEventHandler method to hijack routes. I should try it.
If you continue to have trouble, you could try creating a class in your project root that inherits the WebBootManager to hijack routing. This is the way I learned and it has worked for me. An example of that would be:
Hope this helps. I'm sure someone more knowledgeable than myself will chime in.
I removed 'Controller' and it worked. Thanks so much.
is working on a reply...