|--main.master |-- index.aspx |-- user.master |-- login.aspx
<asp:LoginView ID="HeadLoginView" runat="server" EnableViewState="false"> <AnonymousTemplate> [ <a href="~/PageCommon/login.aspx" id="HeadLoginStatus" runat="server" color="#87cfe6">Log In</a> ] </AnonymousTemplate> <LoggedInTemplate> Welcome <span class="bold"> <asp:HyperLink ID="HyperLink1" ForeColor="PeachPuff" Font-Size="Larger" ToolTip="MyHome" runat="server"> <asp:LoginName ID="HeadLoginName" runat="server" /></asp:HyperLink> </span> [ <asp:LoginStatus ID="HeadLoginStatus" ForeColor="#87cfe6" runat="server" LogoutAction="Redirect" LogoutText="Log Out" LogoutPageUrl="~/PageCommon/index.aspx" /> ] </LoggedInTemplate> </asp:LoginView>
if (User.Identity.IsAuthenticated) { HyperLink rdirect = (HyperLink)Master.FindControl("HyperLink1"); int index = utype.SelectedIndex; if (index == 0) { rdirect.NavigateUrl = ResolveUrl("~/PageUser/MyProfile.aspx"); } else if (index == 1) { rdirect.NavigateUrl = ResolveUrl("~/PageAdmin/MyProfile.aspx"); } }