2

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.

Community
  • 1
  • 1
Snake Eyes
  • 16,287
  • 34
  • 113
  • 221

1 Answers1

2

I found solution.

In Application_AcquireRequestState, at end of code, insert:

if ( this.Request.UrlReferrer != null ) {
   this.Context.Response.Redirect( this.Request.UrlReferrer.ToString() );
}
Snake Eyes
  • 16,287
  • 34
  • 113
  • 221