Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Martin Harran 16 posts 72 karma points
    Mar 12, 2011 @ 12:21
    Martin Harran
    0

    LoggedInTemplate not showing with default URL

    Using asp.net Login control, logged in, when I go to http://.example.com/default.aspx my LoggedInTemplate shows okay (Welcome username).

    When I go to http://example.com, it doesn't show.

    This is causing problems with users who have activated Remember Me on their login and go to http://example.com and think they aren't logged in because the Welcome message isn't showing.

    What do I need to do to get around this?

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Mar 12, 2011 @ 12:54
    Jan Skovgaard
    0

    Hi Martin

    Isn't that a matter of using the "loginstatus" ASP.NET control?

    Could you perhaps post the code and tell a bit more about your templates and how they're structured?

    /Jan

  • Martin Harran 16 posts 72 karma points
    Mar 12, 2011 @ 15:49
    Martin Harran
    0

    It's standard Asp.net login controls in the Master template with a bit of extra text and some extra classes to allow our own styling. Here's the relevant code:

     

    <div class="loginDisplay">
        <asp:LoginView ID="HeadLoginView" runat="server" EnableViewState="false">
            <AnonymousTemplate>
       <div id="top_menu">
        <ul id="universal_head" class="dropdown">
                        <!-- Guest Navigation items -->                
              </ul>
                </div>
            </AnonymousTemplate>

            <LoggedInTemplate>
                <div id="top_menu">
        <div id="welcome">
         Welcome <span class="bold"><asp:LoginName ID="HeadLoginName" runat="server" /></span>, to siansplan.com
        </div>
        <div id="logged_in">
         <ul id="universal_head">
                            <!-- Looged in User navigation items -->
                  </ul>
                  </div>
                </div>
            </LoggedInTemplate>
        </asp:LoginView>
    </div>

    <div class="loginpanel">>
        <asp:Login ID="LoginUser" runat="server" EnableViewState="false" RenderOuterTable="false">
            <LayoutTemplate>
                <span class="failureNotification">
                    <asp:Literal ID="FailureText" runat="server"></asp:Literal>
                </span>
                <asp:ValidationSummary ID="LoginUserValidationSummary" runat="server" CssClass="failureNotification"
                        ValidationGroup="LoginUserValidationGroup"/>
                <div class="accountInfo">
                    <fieldset class="login">
                        <legend>Account Information</legend>
                        <p>
                            <asp:Label ID="UserNameLabel" runat="server" AssociatedControlID="UserName" >Username:</asp:Label>
                            <asp:TextBox ID="UserName" runat="server" CssClass="textEntry"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="UserNameRequired" runat="server" ControlToValidate="UserName"
                                    CssClass="failureNotification" ErrorMessage="User Name is required." ToolTip="User Name is required."
                                    ValidationGroup="LoginUserValidationGroup">*</asp:RequiredFieldValidator>
                        </p>
                        <p>
                            <asp:Label ID="PasswordLabel" runat="server" AssociatedControlID="Password">Password:</asp:Label>
                            <asp:TextBox ID="Password" runat="server" CssClass="passwordEntry" TextMode="Password"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="PasswordRequired" runat="server" ControlToValidate="Password"
                                    CssClass="failureNotification" ErrorMessage="Password is required." ToolTip="Password is required."
                                    ValidationGroup="LoginUserValidationGroup">*</asp:RequiredFieldValidator>
                        </p>
                        <p class="login_rem">
                            <asp:CheckBox ID="RememberMe" runat="server"/>
                            <asp:Label ID="RememberMeLabel" runat="server" AssociatedControlID="RememberMe" CssClass="inline">Keep me logged in</asp:Label>
                        </p>
                    </fieldset>

                    <p class="login_submitButton">
                        <asp:Button ID="LoginButton" style="margin-left:20px;" runat="server" class="button_standard" CommandName="Login" Text="Sign In" ValidationGroup="LoginUserValidationGroup"/>
                    </p>
              <div class="register_img">   
                  <img src="/media/161/signup.png" alt="Register for an account"/>
              </div>

              <div class="login_register">
                        <p>
               <a href="register.aspx" style="color:Red;">Register</a> for an account.
                  </p>
              </div>
                </div>
            </LayoutTemplate>
        </asp:Login>
    </div>

  • Martin Harran 16 posts 72 karma points
    Mar 12, 2011 @ 16:15
    Martin Harran
    0

    Jan, I just tried LoginStatus to see if it would be any different from the LoginView that I've used. It isn't any different, going to URL with page name e.g. http://example.com/default.aspx shows User Logout, going to without the page name shows User Login.

    I should have perhaps mentioned that default.aspx is set up as the default page for the site in both Umbraco and IIS  and is working okay - http://example.com/  and http://example.com/default.aspx both show the same body content.

Please Sign in or register to post replies

Write your reply to:

Draft