Attribute 'localpath' not recognized when calling Login.ashx page

May 7, 2015 at 12:45 PM
Edited May 11, 2015 at 12:48 PM
Hi,

I'm beginning a new ASP.Net/C# project where I need to configure the SP metadata for a SAMLv2 IDP. I'm having the two troubles:
  • Several messages like : Could not find schema information for the element 'X', where X can be saml2, serviceProvider, localpath, ... (all that's in the <saml2> section of the Web.config file)
  • When I launch my application, I go to a page __http://localhost:9311/__, witch loads the ASP.NET presentation page. If I try to enter the address __http://localhost:9311/Login.ashx__, or __http://localhost:9311/Metadata.ashx__ to test the application endpoints, I have the following error message in my browser : Attribute 'localpath' not recognized. This message points to the first Web.config <endpoint> tag:
<endpoint localpath="Login.ashx" type="signon" redirectUrl="~/AuthenticatedHomePage" />
Do you think the error is related to the Web.config messages? How can I proceed in order to solve this?

Thanks in advance for your help,
Marc
May 11, 2015 at 12:35 PM
Edited May 15, 2015 at 7:55 AM
Hi again.

Sorry for the double post, but I decided to post my Web.config file, it may help to see what is not ok:
<?xml version="1.0" encoding="utf-8"?>
<!--
  Pour plus d’informations sur la configuration de votre application ASP.NET, rendez-vous sur 
  http://go.microsoft.com/fwlink/?LinkId=301880
  -->
<configuration>
  <configSections>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
    <section name="saml2" type="SAML2.Config.Saml2Section, SAML2" />
  </configSections>
  <connectionStrings>
    <add name="DefaultConnection" connectionString="Data Source=(LocalDb)\v11.0;AttachDbFilename=|DataDirectory|\aspnet-saml20app-20150511012812.mdf;Initial Catalog=aspnet-saml20app-20150511012812;Integrated Security=True" providerName="System.Data.SqlClient" />
  </connectionStrings>
  <appSettings>
    <add key="webpages:Version" value="3.0.0.0" />
    <add key="webpages:Enabled" value="false" />
    <add key="ClientValidationEnabled" value="true" />
    <add key="UnobtrusiveJavaScriptEnabled" value="true" />
    <add key="home.dir" value="C:\Users\myUser\Desktop\testMetadata\" />
  </appSettings>
  <system.web>
    <authentication mode="None" />
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5" />
  </system.web>
  <system.webServer>
    <modules>
      <remove name="FormsAuthentication" />
    </modules>
    <handlers>
      <remove name="SAML2.Protocol.Saml20SignonHandler" />
      <remove name="SAML2.Protocol.Saml20LogoutHandler" />
      <remove name="SAML2.Protocol.Saml20MetadataHandler" />
      <add name="SAML2.Protocol.Saml20SignonHandler" verb="*" path="Login.ashx" type="SAML2.Protocol.Saml20SignonHandler, SAML2" />
      <add name="SAML2.Protocol.Saml20LogoutHandler" verb="*" path="Logout.ashx" type="SAML2.Protocol.Saml20LogoutHandler, SAML2" />
      <add name="SAML2.Protocol.Saml20MetadataHandler" verb="*" path="Metadata.ashx" type="SAML2.Protocol.Saml20MetadataHandler, SAML2" />
    </handlers>
  </system.webServer>
  <runtime>
    ...
  </runtime>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="mssqllocaldb" />
      </parameters>
    </defaultConnectionFactory>
    <providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
    </providers>
  </entityFramework>

  <saml2>
    <serviceProvider id="urn:issuer" server="http://localhost:3301/">
      <endpoints>
        <endpoint localpath="Login.ashx" type="signon" redirectUrl="~/AuthenticatedHomePage" />
        <endpoint localpath="Logout.ashx" type="logout" redirectUrl="~/HomePage" />
        <endpoint localpath="Metadata.ashx" type="metadata" />
      </endpoints>
      <nameIdFormats allowCreate="true">
        <add format="urn:oasis:names:tc:SAML:2.0:nameid-format:transient" />
      </nameIdFormats>
      <authenticationContexts comparison="Exact">
        <add context="urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport" referenceType="AuthnContextClassRef" />
      </authenticationContexts>
    </serviceProvider>
    <identityProviders metadata="C:\Users\myUser\Desktop\testMetadata\metadata_Kit_net_mma.xml" />
    <metadata>
      <contacts>
        <contact type="Administrative" company="" givenName="" surName="" email="" phone="" />
      </contacts>
      <requestedAttributes>
        <add name="urn:cn" />
      </requestedAttributes>
    </metadata>
  </saml2>
</configuration>
Thanks in advance for the answer,
Marc
Coordinator
May 21, 2015 at 6:49 PM
Sorry for the delay, I don't get notifications when people post right now.

Did you get this figured out? It looked like you got at least a little bit farther, given your other message?
May 22, 2015 at 7:06 AM
Hi, thanks for the answer.

I managed to advance further but using a lot of code.

Concerning the localpath attribute, I found it in the Saml2Section file that the correct syntax is 'localPath' with a big 'P'.
I've got the same problem with the 'type' attribute, it needs to be 'SignOn', 'Logout' and 'Metadata' with bigs 'S', 'O', 'L' and 'M' respectively. To be honest it might be some more syntax errors that I don't remember right now... :(

I have in did another question concerning the source code, I will ask in another thread since it's not related.

Thanks again,
Marc