 |
|
ผม ได้ สร้าง Claims 2 ตัว คือ TestUser , TestAdmin
อยากทราบวิธีดึงข้อมูลที่เป็น Name , StreetAddress , "LastName" เขียนยังไงด้บ้างครับ
CS
var identity = new ClaimsIdentity(new[]
{
new Claim(ClaimTypes.Name, model.UserName),
new Claim(ClaimTypes.StreetAddress, "User"),
new Claim("LastName", "User Test"),
}, "TestUser");
this._auth.SignIn(new AuthenticationProperties
{
IsPersistent = false
}, identity);
var identityAdmin = new ClaimsIdentity(new[]
{
new Claim(ClaimTypes.Name, model.UserName),
new Claim(ClaimTypes.StreetAddress, "Admin"),
new Claim("LastName", "Admin Test"),
}, "TestAdmin");
this._auth.SignIn(new AuthenticationProperties
{
IsPersistent = false
}, identityAdmin);
Tag : .NET, Web (ASP.NET), C#
|
|
 |
 |
 |
 |
Date :
2016-12-15 14:18:18 |
By :
shadowwave |
View :
2251 |
Reply :
1 |
|
 |
 |
 |
 |
|
|
|
 |