Skip to main content

Development

Troubleshooting the redirect issue of .NET CAS integration in IE

Background

CAS (Central Authentication Service) is an open source project which was sponsored by Yale and it is an enterprise Single Sign-On solution for web services. The .NET CAS client provides CAS integration for the Microsoft Windows platform via the .NET framework and integrates with ASP.NET applications by customizing the application web.config file. It is convenient for us to deploy SSO with your ASP.NET applications.

Issue

However, when I applied dotnet-client-1.0.2 on my project, I had encountered lots of issues. Most of the common issues I can solved by searching internet except one issue which was unexpected redirection. It returns exception with message too many redirections, but it only occurs in IE browser, not Firefox or Chrome.

Solution

This issue took me a lot of time, I had searched all possible blogs and related forums on internet, but still no solution. Finally, I downloaded the source code and debug it on my project, I tracked the data and find out the root cause. When .NET Client sends a request to CAS server, CAS Server will return a ticket and the cookie .ASPXAUTH was added in IE browser, but the key problem is when .NET Client request to login CAS Server with .ASPXAUTH, the cookie .ASPXAUTH was lost, it was empty, below are solution to fix this issue:

Step1: Find the .NET CAS Client source code, go to CasAuthentication.cs file.

Step2: go to line 1070, find the following code.

Step3: replace code above with following code block and rebuild a new DotNetCasClient.dll.

Step4: re-test, the cookie .ASPXAUTH won’t be empty any more, and login CAS server successfully.

Reference:

https://wiki.jasig.org/display/CASC/.Net+Cas+Client

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Richard Yang

More from this Author

Categories
Follow Us
TwitterLinkedinFacebookYoutubeInstagram