根据asp.net中登录的用户更改菜单项 [英] changing a menu item according to logged in user in asp.net
本文介绍了根据asp.net中登录的用户更改菜单项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我的网站上有一个登录菜单项,我希望它在用户登录时转为个人资料,这是iam在做的事情:
Hi all ,
I have a login menu item in my website and i want it to turn to profile when a user logs in and this is what iam doing :
<asp:LoginView ID="LoginView2" runat="server">
<RoleGroups>
<asp:RoleGroup Roles="Members">
<ContentTemplate>
<a href="~/Members/CustomersList.aspx" id="A44" runat="server">
<img id="Img4" runat="server" alt="Profle" width="160" height="59" border="0" src="/images/profile.jpg"
onmouseover="this.src='/images/profile_hover.jpg'" onmouseout="this.src='/images/profile.jpg'" /></a>
</ContentTemplate>
</asp:RoleGroup>
<asp:RoleGroup Roles="Anonymous">
<ContentTemplate>
<a href="~/Login.aspx" id="A15" runat="server">
<img id="Img4" runat="server" alt="Login" width="160" height="59" border="0" src="/images/Login.jpg"
onmouseover="this.src='/images/Login-hover.jpg'" onmouseout="this.src='/images/Login.jpg'" /></a>
</ContentTemplate>
</asp:RoleGroup>
</RoleGroups>
</asp:LoginView>
但是登录没有出现.那我该怎么办?
请帮忙.
But the login is not appearing .So what can i do ?
Please help.
推荐答案
尝试一下...
try this...
if (Profile.UserName == "X" && User.Identity.IsAuthenticated)
{
}
这篇关于根据asp.net中登录的用户更改菜单项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文