user3507427
user3507427

Reputation: 11

Response.Redirect NOT working in IE 11 when compatibility view disabled

I am having a problem redirecting users from a login screen to a user dashboard in IE 11.

So I am trying to reditect the user from:

http://www.mysite.com/index.aspx?tab=login

to:

http://www.mysite.com/admin/default.aspx?tab=home

The simple code is as follows:

string landingPageURL = "~/admin/default.aspx?tab=home"; 

Response.Redirect(landingPageURL, false);

This does not work when the site has NOT been added to the compatibility view settings.

The code does not throw any errors and works perfectly when compatibility view is enabled, and works on Firefox, Chrome, Safari also.

Once Response.Redirect has executed, the page just seems to reloads again, and does not redirect to the default.aspx page.

I am developing with C# using .NET 4.

Has anyone come across this before?

Upvotes: 0

Views: 6794

Answers (2)

flap13
flap13

Reputation: 411

Try this:

HttpContext.Current.Response.RedirectPermanent(url, true);

This is work for me...

Upvotes: -1

user3507427
user3507427

Reputation: 11

I finally found a resolution to this problem.

It turns out to be a bug in the browser detection under .NET 4 that was causing this.

I needed to add a custom .browser file to the application which has solved the problem.

Upgrading the server to .NET 4.5 will also resolve this.

The solution and the browser file can be found in the following telerik blog.

Upvotes: 1

Related Questions