Reputation: 16754
In Global.asax
, in Application_AcquireRequestState
function, I have a code which changes the language of site.
After changing the language, I want to be redirected to previous page.
How to do this ? It is ok to do in global.asax
?
I mention that doesn't matter on what page you are, the user must be redirected to previous page, means:
page1 -> change language -> page1.
I read How do I redirect to the previous action in ASP.NET MVC? and I want to implement it in Global.asax but I don't know if is ok.
Upvotes: 2
Views: 2229
Reputation: 16754
I found solution.
In Application_AcquireRequestState
, at end of code, insert:
if ( this.Request.UrlReferrer != null ) {
this.Context.Response.Redirect( this.Request.UrlReferrer.ToString() );
}
Upvotes: 2