Click here to Skip to main content
15,887,338 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello,

I want to use claim based system. I have set claim value on button1 BUT not I am not getting values on button2.

Can you please help me to get claim value on button2 or in another page.

Thanks in Advance !


Button1 - Set claim Value
C#
var claims = new List<Claim>();
claims.Add(new Claim(ClaimTypes.Name, "Username"));
claims.Add(new Claim(ClaimTypes.Sid, "11"));
claims.Add(new Claim(ClaimTypes.Role, "Admin"));

Button2: Get claim Value
?

What I have tried:

using System.Security.Claims;

protected void btnSet_Click(object sender, EventArgs e)
{
lblmsg.Text = "";
var claims = new List<claim>();
claims.Add(new Claim(ClaimTypes.Name, "user.FirstName user.LastName"));
claims.Add(new Claim(ClaimTypes.Sid, "11"));
claims.Add(new Claim(ClaimTypes.Role, "Admin"));

}

protected void btnGet_Click(object sender, EventArgs e)
{
lblmsg.Text = claim.Value;
}
Posted
Updated 9-Jul-16 23:03pm

1 solution

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900