Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redirect to action in another controller? #14

Open
djordjedjukic opened this issue Oct 5, 2018 · 1 comment
Open

Redirect to action in another controller? #14

djordjedjukic opened this issue Oct 5, 2018 · 1 comment

Comments

@djordjedjukic
Copy link

Hi Jimmy,

In ControllerExtensions you have method RedirectToActionJson, and you create url for redirect on this way: redirect = controller.Url.Action(action). You are using it like this:
return this.RedirectToActionJson(nameof(Index));

This will not work if you want to redirect on action from another controller.
Mu solution is to change:
redirect = controller.Url.Action(action) to redirect = action
and then to call it:
return this.RedirectToActionJson(Url.Action("Action", "Controller"));

Do you maybe have some better suggestion?

@jbogard
Copy link
Owner

jbogard commented Oct 6, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants