0
我有幫助的方法,如果用戶進行身份驗證這是隻檢查,但其發生錯誤自定義身份驗證助手類。需要幫助
Helper方法
public static bool IsLoggedIn(this HtmlHelper helper)
{
return helper.ViewContext.HttpContext.Request.IsAuthenticated;
}
查看
@if (GH.IsLoggedIn) //Error is on this line
{
<div class="sign-text" >Signed In As @GH.IdentityName </div>
}
錯誤
Compiler Error Message: CS0428: Cannot convert method group 'IsLoggedIn' to non-delegate type 'bool'. Did you intend to invoke the method?
有人告訴我最新的問題。
感謝我的愚蠢。你能告訴我如何寫這個三元語句請@ Html.IsLoggedIn()?
'@ Html.Raw(Html.IsLoggedIn()?「
你想讓我在你的SignInText的HtmlHelp中使用上面的Singin鏈接。從視圖隱藏邏輯? – Pirzada 2011-06-06 00:37:11