Hi
how do I code for a razor conditional statement to check whether a member i logged in or not and do separate things for each condition.i tried searching the net and our umbraco but everything i tested returned a runtime error.
Thanks
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@{ var currentMember = umbraco.cms.businesslogic.member.Member.GetCurrentMember();
@if (currentMember != null) {
//This is where the member is logged in
<p id="statusmsg">Welcome @currentMember.LoginName </p>
}
else{
//This is where the member is NOT logged in
<p id="statusmsg">Please log in</p>
}
}
Thanks desley
But the problem is that the code makes the site show runtime error.
I first wrote it with Membership.GetUser with no conditional logics but as soon as i change it to conditional it returns runtime error!
login Status
Hi how do I code for a razor conditional statement to check whether a member i logged in or not and do separate things for each condition.i tried searching the net and our umbraco but everything i tested returned a runtime error. Thanks
Might be better ways but this should work atleast.
still runtime error am i doing it wrong?
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage @{ var currentMember = umbraco.cms.businesslogic.member.Member.GetCurrentMember(); @if (currentMember != null) {
"مهمان"
}
can't i use something like isloggedon?
Thanks desley But the problem is that the code makes the site show runtime error. I first wrote it with Membership.GetUser with no conditional logics but as soon as i change it to conditional it returns runtime error!
You were trying to get a property from the member object when it was null. Try the code above, it works fine when I try it myself.
If it still doesn't work I can't help you any further. My programming knowledge is very limited too.
I know i had corrected it before ;) Thanks anyway I found nothing helping on the net
is working on a reply...