Redirect auf URL in ASP-CORE

Ich habe ein problem mit der Umleitung auf einen anderen Controller und action in der Anwendung.

Mein Redirect Action Aussehen:

    public IActionResult Redirect(NotificationItemViewModel model)
    {
        NotificationItemToggleReadCommand command = new NotificationItemToggleReadCommand();
        command.Id = new EntityId(model.Id);
        command.MarkAsRead = true;


        var result = CommandProcessor.Run(command);
        RedirectResult redirectResult = new RedirectResult(model.Subject.Url,true);
        return redirectResult;
    }

Mein Modell.Thema.Url wird z.B. in diesem format : Identity/User#/Details/b868b08c-b3ba-4f45-a7b6-deb02440d42f

It-Bereich/controller/action/id.
Problem ist, dass mein RedirectResult Umleitung mich zu:

notifications/Identity/User#/Details/b868b08c-b3ba-4f45-a7b6-deb02440d42f 

ist und dass die route nicht vorhanden (controller/Bereich/controller/action/id)
Wie kann die Kraft dies umleiten, um abgeschnitten die ersten dieser controller name?

Meine Routen:

    app.UseMvc(routes =>
        {
            routes.MapRoute("areaRoute", "{area:exists}/{controller}/{action=Index}/{id?}");

            routes.MapRoute(
                name: "controllerActionRoute",
                template: "{controller}/{action}",
                defaults: new { controller = "Home", action = "Index" },
                constraints: null,
                dataTokens: new { NameSpace = "default" });

            routes.MapRoute(
                name: "default",
                template: "{controller=Home}/{action=Index}/{id?}");
        });
    }

Danke für die Hilfe.

InformationsquelleAutor Ridikk12 | 2016-09-24

Schreibe einen Kommentar