Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Recently I made a post in Stackoverflow on a certain problem I am having.
I have problems routing my RedirectToAction(); from a surfacecontroller -> action to a RenderMvcController -> action.
I get the following error:
No route in the route table matches the supplied values
My plan is to send the loginViewModel to the other controller that will later call a service with help of some parameters I have stored on my loginViewModel.
public class AuthenticationController : SurfaceController
public async Task<ActionResult> Login(LoginViewModel loginViewModel)
bool success = false;
var response = await _authenticationService.LoginUserAndGetTicketAsync(new AuthorizeCurrentUserInputModel()
ndsUserName = loginViewModel.Username,
ndsUserPasswd = loginViewModel.Password
success = response.Item1;
ticket = response.Item2;
} catch (Exception e)
this.ModelState.AddModelError(String.Empty, @"Något gick fel.");
return View("Login", loginViewModel);
return RedirectToAction("Index", "MinaSidor"); <--- returns No route registred
this.ModelState.AddModelError(String.Empty, @"Användarnamn eller lösenord är fel.");
return View("Login", loginViewModel);
public class MinaSidorController : RenderMvcController
public ActionResult Index(ContentModel model)
I have checked the forum and tried whats out there but none of it has helped me.
What I have read:
2. RedirectToAction correctly in surfacecontroller
When you inherit from RenderMvcController within Umbraco it's a bit different to a pure MVC experience.
By default the controllers aren't autorouted via the Url you would expect in MVC and so returning Redirect To Action will report that a route cannot be founded.
RenderMvcController are routed by convention...
Eg any controller called DocTypeAliasController will handle any requests made to a page based on that particular Document Type (it's called route hijacking)
Anyway if you have a document type called 'MinaSidor'... Then what you need to do is redirect to a published page that uses that document type.
There is a special helper return method called RedirectToUmbracoPage that will allow you to achieve that from your surface controller...
If you don't have a Document Type with that name... Then you could explicitly register a custom route for it... However you can see it needs the context of an Umbraco content item in the Index action result and to achieve this you use 'MapUmbracoRoute' instead of 'MapRoute' and the your Redirect To Action would 'just work' like standard mvc
I tried register a route for MinaSidor and took the example in the umbraco documentation but it wont run.
I get the following Exception:
[Exception: No physical template file was found for template Index]
Umbraco.Web.Mvc.RenderMvcController.CurrentTemplate(T model) in D:\a\1\s\src\Umbraco.Web\Mvc\RenderMvcController.cs:86
public class RegisterCustomRouteComposer : ComponentComposer<RegisterCustomRouteComponent>
public class RegisterCustomRouteComponent : IComponent
public void Initialize()
// Custom route to MyProductController which will use a node with a specific ID as the
// IPublishedContent for the current rendering page
controller = "MinaSidor",
id = UrlParameter.Optional
}, new UmbracoVirtualNodeByIdRouteHandler(1145));
public void Terminate()
// Nothing to terminate
As for using surfacecontroller and the autorouting rules i need to somehow pass my CustomModel that holds the user ticket.
When I decide to change that inheritance : surfaceController I get:
Cannot bind source type Umbraco.Web.Models.ContentModel to model type legimusWeb.ViewModels.LoginViewModel
LoginViewModel // customModel
SurfaceController wants me to send a ContentModel.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted