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:

Covid 19
COVID-19: Digital Insights For Enterprise Action

Access Perficient’s latest insights into how you can leverage digital technologies to not only respond to the pandemic, but drive your operations forward and deliver experiences your customers need.

Get Informed

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

About the Author

More from this Author

Leave a Reply

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

Subscribe to the Weekly Blog Digest:

Sign Up
Categories