0

I am an ASP.Net MVC application that uses claims based identity. I created a security token service (STS) for authentication. My MVC application is hosted on IIS default website. My application is working perfectly. But scripts are not working. Currently I have disabled anonymous authentication (which is a the requirement). Thank you.

Error Message: enter image description here

felix Antony
  • 1,450
  • 14
  • 28

2 Answers2

2

Finally I got the solution.

For claims based identity, We have to configure on webconfig as follows:

<modules>
      <remove name="FormsAuthentication" />
      <add name="WSFederationAuthenticationModule" type="System.IdentityModel.Services.WSFederationAuthenticationModule, System.IdentityModel.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"  preCondition="integratedMode" />
      <add name="SessionAuthenticationModule" type="System.IdentityModel.Services.SessionAuthenticationModule, System.IdentityModel.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" preCondition="integratedMode" />
    </modules>

It will work.

Thank you all.............

felix Antony
  • 1,450
  • 14
  • 28
  • do you know if this is also a requirement for MVC5 which appears to used a claims based model. – Tim Jul 22 '13 at 07:08
  • that web.config section you specified, it isn't in my web.config from a vs2013 preview MVC5 template. So the question is, If i am using the new claims based model in MVC5 should i have the web.config modules section you specified? and or, i assume windows forms authentication should be disabled on the website. – Tim Jul 22 '13 at 09:17
  • No on the MVC5 it will not be there. After adding identity and access procedure it will create in your web config. – felix Antony Jul 22 '13 at 10:37
  • http://visualstudiogallery.msdn.microsoft.com/e21bf653-dfe1-4d81-b3d3-795cb104066e – felix Antony Jul 22 '13 at 10:38
  • 1
    If it helps anyone else, note the `preCondition="integratedMode"` on the end of each element. This was set to `preCondition="managedHandler"` in my project. After changing to "integratedMode" it worked. – user2444499 Dec 08 '16 at 00:19
1

You should allow access to scripts folder to all requests, add this to web.config. Allow access to CSS folder also in the same way.

<location path="Scripts">
    <system.web>
      <authorization>
        <allow users="*" />
      </authorization>
    </system.web>
</location>
ssilas777
  • 9,672
  • 4
  • 45
  • 68