İsmail Kurnaz
İsmail Kurnaz

Reputation: 1

How to stay on the current page when change language?

I have an ASP.NET MVC web project supporting multiple languages. I used resources for the project. It is working well. But I have a problem. When I changed the language, it is always redirected to the home page. How to stay on the current page when changing the language?

Upvotes: 0

Views: 542

Answers (1)

Hgrbz
Hgrbz

Reputation: 223

If you are using language changer button action (ChangeLanguage ActionResult(or some other name) )your return value is should be some like this:

return RedirectToAction("Index", "Home");

change that that with this:

return Redirect(Request.UrlReferrer.PathAndQuery);

this provides return to the current page.

Upvotes: 1

Related Questions