我正在使用带有身份2.0的mvc 5.我想在应用程序上使用自定义声明值,但我得到null值.我究竟做错了什么?
更新的代码
帐户控制器中的登录代码
if (!string.IsNullOrEmpty(model.UserName) && !string.IsNullOrEmpty(model.Password))
{
AuthenticationManager.SignOut(DefaultAuthenticationTypes.ExternalCookie);
var result = SignInManager.PasswordSignIn(model.UserName, model.Password, model.RememberMe, shouldLockout: false);
//Generate verification token
Dictionary<string, string> acceccToken = null;
if (SignInStatus.Success == 0)
{
var userDeatails = FindUser(model.UserName, model.Password).Result;
if (userDeatails != null)
acceccToken = GetTokenDictionary(model.UserName, model.Password, userDeatails.Id);
}
if (model.RememberMe)
{
HttpCookie userid = new HttpCookie("rembemberTrue", "1");
userid.Expires.AddDays(1);
Response.Cookies.Add(userid);
}
else
{
HttpCookie userid = new HttpCookie("rembemberTrue", "0");
userid.Expires.AddDays(1);
Response.Cookies.Add(userid);
}
#region custom claims
var claims = new Claim[]
{
new Claim("urn:Custom:MasterUniqueId", …Run Code Online (Sandbox Code Playgroud) c# claims-based-identity owin asp.net-mvc-5 asp.net-identity
我正在从存储过程生成 html,但它将 html 标签编码为“<”、“>”或“&”。我在生成标签时需要标签。我已经尝试过 [CDATA] 但没有得到我预期的结果。
select '<ul class=''downloaditems-grid''>'+(
select stuff(
(
select '<li>'+ convert(nvarchar(max),Filepath) +'</li>'
from(
select ('<p>'+UploadDocumentName+'</p><a target=''_blank'' class=''ml10'' href='''+DocumentFilePath+'''title=''Download''>') As Filepath from table1 CLRD
where
isnull(CLRD.IsDeleted,0) <> 1 and orderid=2
)
as T for xml path('')),1,2,'')) +' </ul>' a
Run Code Online (Sandbox Code Playgroud)
它返回
<ul class='downloaditems-grid'>t;li><P>bill.png</><a target='_blank' class='ml10' href='2c0a7c0c-d228-4f5d-9a8f-eb32911509db.png'title='Download'></li> </ul>
Run Code Online (Sandbox Code Playgroud)
但我的要求是:
<ul class='downloaditems-grid'>
<li><p>bill.png</p>
<a target='_blank' class='ml10' href='2c0a7c0c-d228-4f5d-9a8f-eb32911509db.png' title='Download'>
</a>
</li>
</ul>
Run Code Online (Sandbox Code Playgroud)
表结构
除了在创建 html 标签时使用替换我在那里解码的方式之外,任何人都可以给出一些提示吗?