Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MS Identity and Access Tool MVC 4

This VS 2012 extension is meant to allow me to add a local Development STS to my MVC application http://visualstudiogallery.msdn.microsoft.com/e21bf653-dfe1-4d81-b3d3-795cb104066e

I follow the very simple instructions e.g. Right Click the project name and select Identity and Access in the menu. Select your Identity Provider and the OK to apply the settings to your web.config.

I run my MVC 4 application and it redirects immediately to login.aspx

I'm guessing there are special instructions for MVC 4.

What are they?

Where do I find them?

EDIT

To be clear I have created a ASP.MVC 4 Internet application in visual studio 2012. Then I am using the Identity & Access Tool to add a local development STS to Test my application.

I am running the site on a local IIS Express

When I debug the application I am redirected to

localhost:11378/login.aspx?ReturnUrl=%2f

This occurs even if I remove forms authentication as suggested in advice already given.

like image 548
Peter Avatar asked Oct 11 '12 04:10

Peter


People also ask

What is Microsoft ASP.NET MVC 4?

ASP.NET MVC 4 is a framework for developing highly testable and maintainable Web applications that follow the Model-View-Controller (MVC) pattern. The framework encourages you to maintain a clear separation of concerns— views for UI, controllers for handling user input, and models for domain logic.


2 Answers

In my case I added this

<system.web>
...
<httpModules>
...
    <remove name="FormsAuthentication" />
</httpModules>
</system.web>

and this

<system.webServer>
...
   <modules>
   ...
      <remove name="FormsAuthentication" />
   </modules>
</system.webServer>

EDIT

The next problem you might get is this

A claim of type 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier' or 'http://schemas.microsoft.com/accesscontrolservice/2010/07/claims/identityprovider' was not present on the provided ClaimsIdentity. To enable anti-forgery token support with claims-based authentication, please verify that the configured claims provider is providing both of these claims on the ClaimsIdentity instances it generates. If the configured claims provider instead uses a different claim type as a unique identifier, it can be configured by setting the static property AntiForgeryConfig.UniqueClaimTypeIdentifier.

add these 2 claims to the Development STS in the Identity and Access Tool

http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier
http://schemas.microsoft.com/accesscontrolservice/2010/07/claims/identityprovider

and add this line to your Global.asax

AntiForgeryConfig.UniqueClaimTypeIdentifier = ClaimTypes.NameIdentifier;

This article helped me

like image 146
Peter Avatar answered Nov 02 '22 23:11

Peter


Removing FormsAuthentication module worked for me.

 <httpModules>
    ...
    <remove name="FormsAuthentication" />
 </httpModules>
like image 44
Rob Curtis Avatar answered Nov 03 '22 00:11

Rob Curtis