Copied to clipboard

Flag this post as spam?

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


  • Dan Bolt 2 posts 102 karma points
    Aug 08, 2016 @ 14:12
    Dan Bolt
    0

    dev to live breaks membership, can't log in any more via Public Access

    Hello Folks,

    I've been tearing my (greying!) hair out over this all day long. I've just moved a new site for a local authority onto their (what will eventually be) live server. Everything works perfectly... until I try to restrict access to the whole site by using Public Access settings on the home node.

    I have a Member set up, login & login-error pages all written and working perfectly on my localhost development machine. Now when I try to log into the new site I simply keep getting told I'm not logged in. It doesn't take me to the error page, and indeed in the logfile I get this:

    2016-08-08 14:52:01,934 [P2256/D24/T13] INFO Umbraco.Core.Security.UmbracoMembershipProviderBase - Login attempt succeeded for username tempwebadmin from IP address xxx.xxx.xxx28.163

    Any light you kind folks can shed on this odd behaviour would be most appreciated! My server is 2012 r2, SQL2008, .net 4.5 is installed, Umbraco version 7.4.3.

    Here's my login page (I also have the additional @Html.RenderJsHere() in my master-page in the correct place) which works locally but not on my new server

        @inherits Umbraco.Web.Mvc.UmbracoTemplatePage
    @using System.Web.Mvc.Html
    @using ClientDependency.Core.Mvc
    @using Umbraco.Web
    @using Umbraco.Web.Models
    @using Umbraco.Web.Controllers
    
    @{
        Layout = "template_Master.cshtml";
    }
    
    
            <!-- main -->
            <main role="main">
                <div id="main-container">
                    <div class="main wrapper clearfix">
                        <div class="content clearfix">
                            <article role="article">
                                <!-- article header -->
                                <header>
                                <h1>@Umbraco.Field("pageName")</h1>
                                </header>
                                <!-- article header -->
    
                                <section>
    
                                    @Umbraco.Field("bodyText")
    
    
                                    @{
                                        var loginModel = new LoginModel();
    
                                        Html.EnableClientValidation();
                                        Html.EnableUnobtrusiveJavaScript();
                                        Html.RequiresJs("~/umbraco_client/ui/jquery.js");
                                        Html.RequiresJs("~/umbraco_client/Application/JQuery/jquery.validate.min.js");
                                        Html.RequiresJs("~/umbraco_client/Application/JQuery/jquery.validate.unobtrusive.min.js");
    
                                        if (Members.GetCurrentLoginStatus().IsLoggedIn)
                                        {
    
                                            @Html.Raw("<p>YOU ARE LOGGED IN!<p>");
                                        }
                                        else
                                        {
                                            @Html.Raw("<p>YOU ARE NOT LOGGED IN!<p>");
                                        }
                                    }
    
    
                                    @* NOTE: This RenderJsHere code should be put on your main template page where the rest of your script tags are placed *@
    
    
                                    @using (Html.BeginUmbracoForm<UmbLoginController>("HandleLogin"))
                                    {
                                        <fieldset>
                                            <legend>Login</legend>
    
                                            @Html.ValidationSummary("loginModel", true)
    
                                            @Html.LabelFor(m => loginModel.Username)
                                            @Html.TextBoxFor(m => loginModel.Username)
                                            @Html.ValidationMessageFor(m => loginModel.Username)
                                            <br />
    
                                            @Html.LabelFor(m => loginModel.Password)
                                            @Html.PasswordFor(m => loginModel.Password)
                                            @Html.ValidationMessageFor(m => loginModel.Password)
                                            <br />
    
                                            <button>Login</button>
                                        </fieldset>
                                    }
    
                                </section>
                                <!-- article footer -->
                                <footer>
                                    @Html.Partial("partialView_DateUpdate")
                                </footer>
                                <!-- article footer -->
                            </article>
                            <!-- page support -->
                            <aside class="page-support clearfix">
                                <!-- page support nav -->
                                @Html.Partial("partialView_PageSupportNav-Problem")
                                <!-- page support nav -->
                                <!-- page support forms -->
                                @Html.Partial("partialView_PageSupportForm-Problem")
                                <!-- page support forms -->
                            </aside>
                            <!-- page support -->
                        </div><!-- #content -->
                        <div class="related-content">
                            <aside>
                                <!-- related links -->
                                @Html.Partial("partialView_RelatedLinks")
                                <!-- related links -->
                            </aside>
                        </div><!-- #related-content -->
                    </div><!-- #wrapper -->
                </div><!-- #main-container -->
            </main>
            <!-- main -->
    
  • Dan Bolt 2 posts 102 karma points
    Aug 18, 2016 @ 09:21
    Dan Bolt
    100

    Finally I have found what was causing this issue and want to share it with the rest of the community - hopefully it'll stop anyone else making this rookie error.

    Having written my own Member Login view with multiple debug/log-entries it looked like the member was indeed being logged in but that that information wasn't being persisted.

    So any guesses? Well, to my embarrassment it was an IIS config difference between my dev & live servers (in my defence I don't get to build or configure them in my organisation).

    It was all down to the Enabled authentication types. It turns out that you need both Anonymous and Forms Authentication enabling. RTFM I guess ;)

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies