I'm looking for help on a CAS .net client issue. I've set up a couple of .net 
applications to use the CAS .net client for authentication with out much 
problem, in fact there is even a different .net client on the same server that 
is working fine.

However, on this application going to the secured life triggers the CAS login 
screen but after login it throws a redirect loop error, the URL shows the 
CAS.aspx page with the ticket in the URL.

The CAS.aspx is nearly  a mirror image of the one from the working application. 
The web.conf is the application's web.conf tweaked for the CAS .net 
configuration

CAS.aspx:

<%@ Import Namespace="System" %>
<%@ Import Namespace="DotNetCasClient.Utils" %>
<%@ Import Namespace="DotNetCasClient.Security" %>
<%
        'Created by atilling 7/15/13 to integrate virtual EMS with CAS 
 
        if not HttpContext.Current.User is nothing then
                Session("MCSession") = HttpContext.Current.User.Identity.Name 
                if not Request.QueryString("URL") is nothing then
                    dim strUrl as String
                    dim x as String
                    For Each x In Request.QueryString
                        strUrl = strUrl + x + "=" + Request.QueryString(x)
                    Next
                    strUrl=right(strUrl,len(strUrl)-4)
                    Response.Redirect(strUrl)
                else
                    Response.Redirect("Default.aspx")
                end if
        end if
%>

web.conf:

<?xml version="1.0"?>
<!-- 
    Note: As an alternative to hand editing this file you can use the 
    web admin tool to configure settings for your application. Use
    the Website->Asp.Net Configuration option in Visual Studio.
    A full list of settings and comments can be found in 
    machine.config.comments usually located in 
    \Windows\Microsoft.Net\Framework\v2.x\Config  
-->
<configuration>
  <configSections>
    <section name="exceptionHandling" 
type="Dea.ExceptionHandling.ExceptionHandlingSectionHandler, 
Dea.ExceptionHandling"/>
    <!-- Cas Config -->
    <section name="casClientConfig" 
type="DotNetCasClient.Configuration.CasClientConfiguration, DotNetCasClient"/>
    <section name="dataConfiguration" 
type="Dea.Data.Configuration.DatabaseSettings, Dea.Data" 
requirePermission="false"/>
    <sectionGroup name="system.web">
      <section name="externalServiceProviders" 
type="Dea.Providers.ServiceOrders.ExternalServiceProviderSection, 
Dea.Providers.ServiceOrders" allowDefinition="MachineToApplication" 
restartOnExternalChanges="true"/>
    </sectionGroup>
    <sectionGroup name="devExpress">
      <section name="settings" 
type="DevExpress.Web.ASPxClasses.SettingsConfigurationSection, 
DevExpress.Web.v10.2, Version=10.2.6.0, Culture=neutral, 
PublicKeyToken=b88d1754d700e49a" requirePermission="false"/>
      <section name="compression" 
type="DevExpress.Web.ASPxClasses.CompressionConfigurationSection, 
DevExpress.Web.v10.2, Version=10.2.6.0, Culture=neutral, 
PublicKeyToken=b88d1754d700e49a" requirePermission="false"/>
      <section name="themes" 
type="DevExpress.Web.ASPxClasses.ThemesConfigurationSection, 
DevExpress.Web.v10.2, Version=10.2.6.0, Culture=neutral, 
PublicKeyToken=b88d1754d700e49a" requirePermission="false"/>
      <section name="errors" 
type="DevExpress.Web.ASPxClasses.ErrorsConfigurationSection, 
DevExpress.Web.v10.2, Version=10.2.6.0, Culture=neutral, 
PublicKeyToken=b88d1754d700e49a" requirePermission="false"/>
    </sectionGroup>
    <sectionGroup name="system.web.extensions" 
type="System.Web.Configuration.SystemWebExtensionsSectionGroup, 
System.Web.Extensions, Version=3.5.0.0, Culture=neutral, 
PublicKeyToken=31BF3856AD364E35">
      <sectionGroup name="scripting" 
type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, 
Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
        <section name="scriptResourceHandler" 
type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, 
System.Web.Extensions, Version=3.5.0.0, Culture=neutral, 
PublicKeyToken=31BF3856AD364E35" requirePermission="false" 
allowDefinition="MachineToApplication"/>
        <sectionGroup name="webServices" 
type="System.Web.Configuration.ScriptingWebServicesSectionGroup, 
System.Web.Extensions, Version=3.5.0.0, Culture=neutral, 
PublicKeyToken=31BF3856AD364E35">
          <section name="jsonSerialization" 
type="System.Web.Configuration.ScriptingJsonSerializationSection, 
System.Web.Extensions, Version=3.5.0.0, Culture=neutral, 
PublicKeyToken=31BF3856AD364E35" requirePermission="false" 
allowDefinition="Everywhere"/>
          <section name="profileService" 
type="System.Web.Configuration.ScriptingProfileServiceSection, 
System.Web.Extensions, Version=3.5.0.0, Culture=neutral, 
PublicKeyToken=31BF3856AD364E35" requirePermission="false" 
allowDefinition="MachineToApplication"/>
          <section name="authenticationService" 
type="System.Web.Configuration.ScriptingAuthenticationServiceSection, 
System.Web.Extensions, Version=3.5.0.0, Culture=neutral, 
PublicKeyToken=31BF3856AD364E35" requirePermission="false" 
allowDefinition="MachineToApplication"/>
          <section name="roleService" 
type="System.Web.Configuration.ScriptingRoleServiceSection, 
System.Web.Extensions, Version=3.5.0.0, Culture=neutral, 
PublicKeyToken=31BF3856AD364E35" requirePermission="false" 
allowDefinition="MachineToApplication"/>
        </sectionGroup>
      </sectionGroup>
    </sectionGroup>
  </configSections>
  <appSettings>
    <add key="maxNumberErrorLogs" value="5"/>
    <add key="QueryStringKey" value="KLKJHF3565DF90G321OILHIWER63O"/>
    <add key="suppressHelpMenu" value="false"/>
    <add key="IgnoreWindowsAuthentication" value="false"/>
    <add key="disallowParentFrames" value="false"/>
    <add key="allowCustomJs" value="true"/>
    <add key="PortalAuthLockdown" value="false"/>
    <add key="showErrorInfo" value="false"/>
    <add key="aspnet:MaxHttpCollectionKeys" value="2000"/>
    <add key="MaximumUploadSizeInBytes" value="4096000"/>
    <add key="useHostNameForConnectionSwitching" value="false"/>
    <!--<add key="logoutOverrideUrl" value="default.aspx"/>-->
    <!--<add key="loginOverrideUrl" value=""/>-->
   
    
    <add key="useSaml" value="false"/>
    <!-- Required for SAML auth to work  BaseID, NameID, EncryptedID  -->
    <add key="samlSubjectUserIdField" value="NameID"/>
    <!-- samlIssuer: 
      Optional, will be verified if supplied
    <add key="samlIssuer" value="yourIssuerHere" />
    -->
    <!-- samlCert:
      Optional, will be verified if supplied
    <add key="samlCert" value="yourBase64EncodedPublicKey"/>
    -->
    <!-- samlErrorOrGuest :
      Guest: User redirected to Login page
      Error: User redirected to Error page - No Access
    -->
    <add key="samlErrorOrGuest" value="Error"/>
  </appSettings>
  <connectionStrings>
    <add name="deaConnection" providerName="System.Data.SqlClient" 
connectionString="server=sumac\sumactest;database=ems;"/>
   
  </connectionStrings>
  <dataConfiguration>
    <databaseConnections>
      <add name="deaConnection" useEmsUser="true" useDetailedLogging="true" 
defaultCommandTimeout="20"/>

    </databaseConnections>
  </dataConfiguration>
  <!-- CAS Config element -->
  <casClientConfig casServerLoginUrl="https://cas.conncoll.edu/cas/login"; 
                                
casServerUrlPrefix="https://cas.conncoll.edu/cas/"; 
                                serverName="http://emstst.conncoll.edu"; 
                                notAuthorizedUrl="~/NotAuthorized.aspx" 
                                cookiesRequiredUrl="~/CookiesRequired.aspx" 
                                redirectAfterValidation="true" 
                                gateway="false" 
                                renew="false" 
                                singleSignOut="false" 
                                ticketTimeTolerance="5000" 
                                ticketValidatorName="Cas20" />
  <exceptionHandling mode="On">
    <logger mode="On" assembly="Dea.ExceptionHandling" 
type="Dea.ExceptionHandling.Loggers.DefaultLogger"/>
    <logger mode="Off" assembly="Dea.ExceptionHandling" 
type="Dea.ExceptionHandling.Loggers.DefaultXmlLogger" exceptionFormat="xml"/>
    <!-- In order for this work, you will need to create the registry key for 
the applicationName attribute at 
      HKLM\SYSTEM\CurrentControlSet\services\eventlog 
      
      You can customize event id by adding the exception type as a key value 
pair:
      ArgumentNullException="1234"
    -->
    <logger mode="Off" assembly="Dea.ExceptionHandling" 
type="Dea.ExceptionHandling.Loggers.AppLogLogger" applicationName="VirtualEms"/>
  </exceptionHandling>
  <system.web>
    <sessionState mode="InProc" timeout="20" 
stateConnectionString="tcpip=loopback:42424"/>
    <!-- If you server requires to comply with the Federal Information Process 
Standards then uncomment the below line -->
    <!--<machineKey validationKey="AutoGenerate,IsolateApps" 
decryptionKey="AutoGenerate,IsolateApps" validation="3DES" 
decryption="3DES"/>-->
    <machineKey 
validationKey="564717E33DB0A8D59C27B5C5BF685F73CEB18E809D03D6B27D346BFD405A0C42BE7A36804A31B37FD6AFF1D2055495BB2D87038AC8EED39972B7DC935C60F1E1"
 decryptionKey="9D541D1ACDF01C8D3498A00F390A4180BC357B108B371A09" 
validation="SHA1"/>
    <pages validateRequest="false" viewStateEncryptionMode="Always">
      <controls>
        <add assembly="Dea.Web.Controls" namespace="Dea.Web.Controls" 
tagPrefix="Dea"/>
        <add assembly="System.Web.Mobile" 
namespace="System.Web.UI.MobileControls" tagPrefix="mobile"/>
        <add tagPrefix="asp" namespace="System.Web.UI" 
assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, 
PublicKeyToken=31BF3856AD364E35"/>
        <add tagPrefix="asp" namespace="System.Web.UI.WebControls" 
assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, 
PublicKeyToken=31BF3856AD364E35"/>
      </controls>
    </pages>
    <!-- 
            Set compilation debug="true" to insert debugging 
            symbols into the compiled page. Because this 
            affects performance, set this value to true only 
            during development.
        -->
    <compilation debug="false">
      <assemblies>
        <add assembly="DevExpress.Web.ASPxHtmlEditor.v10.2, Version=10.2.6.0, 
Culture=neutral, PublicKeyToken=B88D1754D700E49A"/>
        <add assembly="DevExpress.Web.v10.2, Version=10.2.6.0, Culture=neutral, 
PublicKeyToken=B88D1754D700E49A"/>
        <add assembly="DevExpress.Web.ASPxEditors.v10.2, Version=10.2.6.0, 
Culture=neutral, PublicKeyToken=B88D1754D700E49A"/>
        <add assembly="DevExpress.Web.ASPxSpellChecker.v10.2, Version=10.2.6.0, 
Culture=neutral, PublicKeyToken=B88D1754D700E49A"/>
        <add assembly="DevExpress.Data.v10.2, Version=10.2.6.0, 
Culture=neutral, PublicKeyToken=B88D1754D700E49A"/>
        <add assembly="DevExpress.SpellChecker.v10.2.Core, Version=10.2.6.0, 
Culture=neutral, PublicKeyToken=B88D1754D700E49A"/>
        <add assembly="System.Data.OracleClient, Version=2.0.0.0, 
Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.Design, Version=2.0.0.0, Culture=neutral, 
PublicKeyToken=B03F5F7F11D50A3A"/>
        <add assembly="System.DirectoryServices, Version=2.0.0.0, 
Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
        <add assembly="System.DirectoryServices.Protocols, Version=2.0.0.0, 
Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
        <add assembly="System.Data, Version=2.0.0.0, Culture=neutral, 
PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System, Version=2.0.0.0, Culture=neutral, 
PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.Xml, Version=2.0.0.0, Culture=neutral, 
PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.Web, Version=2.0.0.0, Culture=neutral, 
PublicKeyToken=B03F5F7F11D50A3A"/>
        <add assembly="System.Configuration, Version=2.0.0.0, Culture=neutral, 
PublicKeyToken=B03F5F7F11D50A3A"/>
        <add assembly="System.Web.Services, Version=2.0.0.0, Culture=neutral, 
PublicKeyToken=B03F5F7F11D50A3A"/>
        <add assembly="System.Drawing, Version=2.0.0.0, Culture=neutral, 
PublicKeyToken=B03F5F7F11D50A3A"/>
        <add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, 
PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, 
PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, 
PublicKeyToken=31BF3856AD364E35"/>
        <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, 
PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, 
Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.Security, Version=2.0.0.0, Culture=neutral, 
PublicKeyToken=B03F5F7F11D50A3A"/>
      </assemblies>
    </compilation>
    <!--
            The <authentication> section enables configuration 
            of the security authentication mode used by 
            ASP.NET to identify an incoming user. 
        -->
    <!-- <authentication mode="Windows"/> -->
    <!-- CAS config element -->
    <authentication mode="Forms">
        <forms loginUrl="https://cas.conncoll.edu/cas/login"; timeout="30" 
defaultUrl="~/Default.aspx" cookieless="UseCookies" slidingExpiration="true" 
path="/VirtualEms/" />
    </authentication>
    <!-- CAS config element -->
    <authorization>
        <allow users="*" />
    </authorization>
    <!--
            The <customErrors> section enables configuration 
            of what to do if/when an unhandled error occurs 
            during the execution of a request. Specifically, 
            it enables developers to configure html error pages 
            to be displayed in place of a error stack trace.

        <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
            <error statusCode="403" redirect="NoAccess.htm" />
            <error statusCode="404" redirect="FileNotFound.htm" />
        </customErrors>
        -->
    <httpHandlers>
      <add verb="GET" path="ImageHandler.axd" 
type="Dea.Web.HttpHandlers.ImageHandler, Dea.Web.HttpHandlers"/>
      <add verb="GET" path="AttachmentHandler.axd" 
type="Dea.Web.HttpHandlers.AttachmentHandler, Dea.Web.HttpHandlers"/>
      <remove verb="*" path="*.asmx"/>
      <add verb="*" path="*.asmx" validate="false" 
type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, 
Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      <add verb="*" path="*_AppService.axd" validate="false" 
type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, 
Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      <add verb="GET,HEAD" path="ScriptResource.axd" validate="false" 
type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, 
Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    </httpHandlers>
    <globalization uiCulture="auto" culture="auto" requestEncoding="utf-8" 
responseEncoding="utf-8"/>
    <httpCookies httpOnlyCookies="false" requireSSL="false" domain=""/>
    <httpModules>
      <!-- CAS config element -->
      <add name="DotNetCasClient" 
type="DotNetCasClient.CasAuthenticationModule,DotNetCasClient" />
      <add type="DevExpress.Web.ASPxClasses.ASPxHttpHandlerModule, 
DevExpress.Web.v10.2, Version=10.2.6.0, Culture=neutral, 
PublicKeyToken=b88d1754d700e49a" name="ASPxHttpHandlerModule"/>
      <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, 
System.Web.Extensions, Version=3.5.0.0, Culture=neutral, 
PublicKeyToken=31BF3856AD364E35"/>
    </httpModules>
    <httpRuntime maxRequestLength="4096" requestLengthDiskThreshold="4096"/>
  </system.web>
  <system.webServer>
    <security>
      <requestFiltering>
        <requestLimits maxAllowedContentLength="4096000"/>
      </requestFiltering>
    </security>
    <handlers>
      <remove name="WebServiceHandlerFactory-Integrated"/>
      <remove name="ScriptHandlerFactory"/>
      <remove name="ScriptHandlerFactoryAppServices"/>
      <remove name="ScriptResource"/>
      <add name="AttachmentHandler.axd_GET" path="AttachmentHandler.axd" 
verb="GET" type="Dea.Web.HttpHandlers.AttachmentHandler, Dea.Web.HttpHandlers" 
preCondition="integratedMode,runtimeVersionv2.0"/>
      <add name="ImageHandler.axd_GET" path="ImageHandler.axd" verb="GET" 
type="Dea.Web.HttpHandlers.ImageHandler, Dea.Web.HttpHandlers" 
preCondition="integratedMode,runtimeVersionv2.0"/>
      <add name="ScriptHandlerFactory" verb="*" path="*.asmx" 
preCondition="integratedMode" 
type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, 
Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      <add name="ScriptHandlerFactoryAppServices" verb="*" 
path="*_AppService.axd" preCondition="integratedMode" 
type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, 
Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      <add name="ScriptResource" verb="GET,HEAD" path="ScriptResource.axd" 
preCondition="integratedMode" type="System.Web.Handlers.ScriptResourceHandler, 
System.Web.Extensions, Version=3.5.0.0, Culture=neutral, 
PublicKeyToken=31BF3856AD364E35"/>
    </handlers>
    <validation validateIntegratedModeConfiguration="false"/>
    <modules>
      <!-- CAS config element -->
      <remove name="DotNetCasClient"/>
      <add name="DotNetCasClient" 
type="DotNetCasClient.CasAuthenticationModule,DotNetCasClient" />
      <remove name="ScriptModule"/>
      <add type="DevExpress.Web.ASPxClasses.ASPxHttpHandlerModule, 
DevExpress.Web.v10.2, Version=10.2.6.0, Culture=neutral, 
PublicKeyToken=b88d1754d700e49a" name="ASPxHttpHandlerModule"/>
      <add name="ScriptModule" preCondition="managedHandler" 
type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, 
Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    </modules>
  </system.webServer>
  <!-- CAS config element -->
  <location path="CAS.aspx">
        <system.web>
            <authorization>
                <deny users="?" />
            </authorization>
        </system.web>
  </location>
  <devExpress>
    <settings rightToLeft="false"/>
    <compression enableHtmlCompression="false" enableCallbackCompression="true" 
enableResourceCompression="true" enableResourceMerging="false"/>
    <themes enableThemesAssembly="true"/>
    <errors callbackErrorRedirectUrl=""/>
  </devExpress>
  <system.codedom>
    <compilers>
      <compiler language="c#;cs;csharp" extension=".cs" 
type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, 
Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4">
        <providerOption name="CompilerVersion" value="v3.5"/>
        <providerOption name="WarnAsError" value="false"/>
      </compiler>
      <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" 
type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, 
Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4">
        <providerOption name="CompilerVersion" value="v3.5"/>
        <providerOption name="OptionInfer" value="true"/>
        <providerOption name="WarnAsError" value="false"/>
      </compiler>
    </compilers>
  </system.codedom>
  <runtime>
    <assemblyBinding appliesTo="v2.0.50727" 
xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Extensions" 
publicKeyToken="31bf3856ad364e35"/>
        <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Extensions.Design" 
publicKeyToken="31bf3856ad364e35"/>
        <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>


Andrew Tillinghast
Sr. Web Developer
[email protected]
270 Mohegan Avenue
New London, CT 06320-4196
Ph:860 439-5265 Fax: 860 439-2871
P Think before you print
CONFIDENTIALITY: This email (including any attachments) may contain 
confidential, proprietary and privileged information, and unauthorized 
disclosure or use is prohibited. If you received this email in error, please 
notify the sender and delete this email from your system.





-- 
You are currently subscribed to [email protected] as: 
[email protected]
To unsubscribe, change settings or access archives, see 
http://www.ja-sig.org/wiki/display/JSG/cas-user

Reply via email to