English 中文(简体)
once link link
原标题:hide log off link once logged in

我需要显示一个标识链接,一旦它们被搁置,就需要把显示作为标志的链接。

这里是我迄今为止所做的事情:

<div class="account-links">

<a href="<%=Page.ResolveUrl("~/logout.aspx")%>" class="ico-logout">
<%=GetLocaleResourceString("Account.Logout")%></a>

<% if (NopContext.Current.User != null && NopContext.Current.User.IsAdmin)
               { %>
<a href="<%=Page.ResolveUrl("~/administration/")%>" class="ico-admin">
  <%=GetLocaleResourceString("Account.Administration")%></a>
    <%} %>


</div>
    <div class="header-links">
        <ul>
            <asp:LoginView ID="topLoginView" runat="server">
                <AnonymousTemplate>

                </AnonymousTemplate>
                <LoggedInTemplate>
                    <li>
                        <a href="<%= SEOHelper.GetMyAccountUrl()%>" class="account"><%=Page.User.Identity.Name %></a>
                        <% if (NopContext.Current.IsCurrentCustomerImpersonated)
                           { 
                        %>
                        <span class="impersonate">(<%=string.Format(GetLocaleResourceString("Account.ImpersonatedAs"), this.CustomerService.UsernamesEnabled ? Server.HtmlEncode(NopContext.Current.User.Username) : Server.HtmlEncode(NopContext.Current.User.Email))%>
                            -
                            <asp:LinkButton runat="server" ID="lFinishImpersonate" Text="<% $NopResources:Account.ImpersonatedAs.Finish %>"
                                ToolTip="<% $NopResources:Account.ImpersonatedAs.Finish.Tooltip %>" OnClick="lFinishImpersonate_Click"
                                CssClass="finish-impersonation"></asp:LinkButton>)</span>
                        <%} %>
                    </li>
                    <li></li>
                    <% if (this.ForumService.AllowPrivateMessages)
                       { %>
                    <li><a href="<%=Page.ResolveUrl("~/privatemessages.aspx")%>" class="ico-inbox">
                        <%=GetLocaleResourceString("PrivateMessages.Inbox")%></a>
                        <asp:Literal runat="server" ID="lUnreadPrivateMessages" />
                    </li>
                    <%} %>
                </LoggedInTemplate>
            </asp:LoginView>
最佳回答

Unless I ve misunderstood Just Add alog off connection to the “Lobed in model” and Add a Point event to it and log off in the Code.

我想掉我头顶。

FormsAuthentication.SignOut() 

这样做

然后,在“匿名模板”上贴上你的标识页。

问题回答

在Asp.Net MVC中,有一份<代码>Request.IsAuthenticated 财产,可用于对User.Identity进行检查。 姓名:不作废。 希望你们也能这样做。





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签