Cookieless sessions and IIS7 causes a redirect loop
Asked Answered
J

1

7

I have an ASP .NET website that uses cookieless sessions. When the initial request is made to the site using a url such as:

http://localhost/site

IE just displays the standard "Internet Explorer cannot display the webpage" message. Firefox is a bit more helpful and displays the following message:

"Redirection limit for this URL exceeded. Unable to load the requested page. This may be caused by cookies that are blocked."

I put some tracing into global.asax and I get into the application start event but not into the session start event.

I have not explictly blocked any cookies with the browsers and have not setup any http redirect rules either.

The site works fine with my development server and under IIS6.

If I switch off cookieless sessions then everything is fine in IIS7.

I can reproduce this with the simplest of websites, i.e. in Visual Studio, File > New Website and then just set the cookieless="true" web.config setting.

I have tested this on a colleauges workstation and it works, so I am guessing it is some setting in IIS7 somewhere.

Any ideas?

Jeremiahjeremias answered 15/4, 2009 at 10:0 Comment(0)
J
6

Well I found the problem.

I had two ISAPI Filters defined both pointing to the same dll:

%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_filter.dll c:\windows\Microsoft.NET\Framework\v2.0.50727\aspnet_filter.dll

I deleted the second one and all was well. I don't know what put the duplicate there, it certainly wasn't me.

Jeremiahjeremias answered 15/4, 2009 at 12:17 Comment(6)
I'd accept this answer if I could, what am I supposed to do about that?Jeremiahjeremias
You can accept your answer a few days after you've added your own answer. so check now :)Mischance
This was the exact issue for me. The cause for mine was having installed .NET Framework 1.1. For some reason it places an additional ISAPI filter in place for 1.1 applications, even though it looks identical to the 2.0 filter.Deflective
Actually, it was not the fault of .NET 1.1. I had two ISAPI filters for .NET 4.0 for some reason. Even though my application was set for 2.0, the extra 4.0 caused the redirect loop. Just thought I would share for future readers.Deflective
I understand that this happens after a software update, I had a similar case and fixed by doing thisCronyism
BIG THANK for posting this answer. I have been trying to solve this problem for a week. Had tried everything except this. May I know how you found that ISAPI could be the issue? I know it's 2017 and you solved it in 2009.. But still if you remember ! :)Mahound

© 2022 - 2024 — McMap. All rights reserved.