Making an ASP.NET MVC Application Claims Aware with Windows Identity Foundation

A couple posts back I had discussed how you would make an ASP.NET webforms application claims aware. It was reasonably detailed an hopefully it was clear.  I say that because to make an MVC application Claims aware, you follow the exact same procedure.

The only difference is the small little chunk of code to see what claims were returned.  Just drop this little snipped into a view and you can muck about:

<ul>
    <%
    var claimsIdentity 
        = (System.Threading.Thread.CurrentPrincipal 
	   as Microsoft.IdentityModel.Claims.IClaimsPrincipal)
	  .Identities[0];
    foreach (var claim in claimsIdentity.Claims)
    {%>
    <li>
       <%: claim.ClaimType %>
    --
    <%: claim.Value %>
    
    <% } %>
    </li>
</ul>

CTTDNUG: ASP.NET MVC Talk Follow Up

A couple of weeks ago I had the opportunity to speak at the Canadian Technology Triangle .NET Users Group.

We had a great crowd of over 60 people eager to learn more about ASP.NET MVC. I was able to do a mix of Visual Studio 2008 and 2010 demos, as well as showcase a production application,  a crowd-sourced translation dictionary for First Nation Languages, currently supporting Maliseet and Mi’kmaw languages (www.sayitfirst.ca).

A question came up in the talk about content management systems and ASP.NET MVC. There was one in particular that intrigued me, but I couldn’t remember the name. After doing some digging it was www.n2cms.com. The interesting angle of N2 is that it is very lightweight, and not meant to be the shell of your entire site, but rather works within your application to serve up content where appropriate. I hope to use this on a future project.

Make sure to check out these other valuable resources as you learn ASP.NET MVC: