I have tried to modify existing examples for SP2010 like this:
- using System;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Web.UI.WebControls.WebParts;
- using System.Security.Claims
- namespace ClaimsViewerTest.VisualWebPart1
- {
- publicpartialclassVisualWebPart1UserControl :UserControl
- {
- protectedvoid Page_Load(object sender,EventArgs e)
- {
- ClaimsPrincipal claimsPrincipal = Page.UserasClaimsPrincipal;
- ClaimsIdentity claimsIdentity = (ClaimsIdentity)claimsPrincipal.Identity;
- GridView1.DataSource = claimsIdentity.Claims;
- Page.DataBind();
- }
- }
- }
But then I get object reference not set... when trying to add the webpart in SP2013.
I have also tried instructions on http://blog.helloitsliam.com/Lists/Posts/Post.aspx?ID=80
but then I get assembly generation failed. Referenced assembly ...... does not have a strong name.
If someone could point me to how I can construct the code properly I would be must grateful as a newbie in SP development.