locked
LoginAdapter breaks the log-in RRS feed

  • Question

  • User-584780720 posted

    When I turn on the LoginAdapter, the Login control no longer does a successful login.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>

    When the user clicks the LogIn button, a postback takes place, but the user is not authenticated. After the postback there are red asterisks next to the username and password fields, which are now empty.<o:p></o:p>

    * I have declared a custom LoginProvider, but *none* of the methods of the LoginProvider are ever called - I set a breakpoint in each function to be sure. When I disable the LoginAdapter, my provider’s ValidateUser is called normally.<o:p></o:p>

    * I listened to all login-related events of the Login control. None are fired.<o:p></o:p>

    * I also set a breakpoint on all CLR exceptions. None are thrown.

    <o:p></o:p> 

    The login control is vanilla:

    <%@ Page Language="C#" MasterPageFile="~/Simple.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="Login_Default" Title="Untitled Page" %>
    <asp:Content ID="Content1" ContentPlaceHolderID="cphRoblox" Runat="Server">
        <asp:Login ID="Login1" runat="server" />
    </asp:Content>
     

    Here is the rendered page:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head><title>
    	Untitled Page
    </title><link href="../App_Themes/RobloxDefault/Frontpage.css" type="text/css" rel="stylesheet" /><link href="../App_Themes/RobloxDefault/Inbox.css" type="text/css" rel="stylesheet" /><link href="../App_Themes/RobloxDefault/Membership.css" type="text/css" rel="stylesheet" /><link href="../App_Themes/RobloxDefault/Message.css" type="text/css" rel="stylesheet" /><link href="../App_Themes/RobloxDefault/Roblox.css" type="text/css" rel="stylesheet" /><link href="../App_Themes/RobloxDefault/Splash.css" type="text/css" rel="stylesheet" /><link href="../App_Themes/RobloxDefault/Toolbox.css" type="text/css" rel="stylesheet" /><link href="../App_Themes/RobloxDefault/User.css" type="text/css" rel="stylesheet" /></head>
    <body>
        <form name="aspnetForm" method="post" action="Default.aspx" language="javascript" onsubmit="javascript:return WebForm_OnSubmit();" id="aspnetForm">
    <input type="hidden" name="__LASTFOCUS" id="__LASTFOCUS" value="" />
    <input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" />
    <input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" />
    <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUJNjI0ODE0MzYwZBgBBR5fX0NvbnRyb2xzUmVxdWlyZVBvc3RCYWNrS2V5X18WAgUhX2N0bDA6Y3BoUm9ibG94OkxvZ2luMTpSZW1lbWJlck1lBSdfY3RsMDpjcGhSb2Jsb3g6TG9naW4xOkxvZ2luSW1hZ2VCdXR0b24SSj4eo6R74TcFlpmMGb6SCG52Zw==" />
    
    <script type="text/javascript">
    <!--
    var theForm = document.forms['aspnetForm'];
    if (!theForm) {
        theForm = document.aspnetForm;
    }
    function __doPostBack(eventTarget, eventArgument) {
        if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
            theForm.__EVENTTARGET.value = eventTarget;
            theForm.__EVENTARGUMENT.value = eventArgument;
            theForm.submit();
        }
    }
    // -->
    </script>
    <script src="/Portal/WebResource.axd?d=3KEX3WdKzeLdxizBJj9tNA2&t=632965876709218750" type="text/javascript"></script>
    <script src="/Portal/WebResource.axd?d=n7goRAFMtbKFGEkZEBRS8GE7CMkgV9sskVIgqzZty0s1&t=632965876709218750" type="text/javascript"></script>
    <script src="/Portal/WebResource.axd?d=VYVcvwDZ6s6Y3ljfisXkfg2&t=632965876709218750" type="text/javascript"></script>
    <script type="text/javascript">
    <!--
    function WebForm_OnSubmit() {
    if (typeof(ValidatorOnSubmit) == "function" && ValidatorOnSubmit() == false) return false;
    return true;
    }
    // -->
    </script>
            <div id="Container">
                <div id="Body">
    <div class="AspNet-Login">
    	<div class="AspNet-Login-TitlePanel">
    		<span>Log In</span>
    	</div>
    	<div class="AspNet-Login-UserPanel">
    		<label for="_ctl0_cphRoblox_Login1_UserName"><em>U</em>ser Name:</label>
    		<input type="text" id="_ctl0_cphRoblox_Login1_UserName" name="$ctl0$cphRoblox$Login1$UserName" value="" accesskey="u" /><span controltovalidate="_ctl0_cphRoblox_Login1_UserName" errormessage="User Name is required." isvalid="False" validationGroup="_ctl0:cphRoblox:Login1" id="_ctl0_cphRoblox_Login1_UserNameRequired" evaluationfunction="RequiredFieldValidatorEvaluateIsValid" initialvalue="" style="color:Red;">*</span>
    	</div>
    	<div class="AspNet-Login-PasswordPanel">
    		<label for="_ctl0_cphRoblox_Login1_Password"><em>P</em>assword:</label>
    		<input type="password" id="_ctl0_cphRoblox_Login1_Password" name="$ctl0$cphRoblox$Login1$Password" value="" accesskey="p" /><span controltovalidate="_ctl0_cphRoblox_Login1_Password" errormessage="Password is required." isvalid="False" validationGroup="_ctl0:cphRoblox:Login1" id="_ctl0_cphRoblox_Login1_PasswordRequired" evaluationfunction="RequiredFieldValidatorEvaluateIsValid" initialvalue="" style="color:Red;">*</span>
    	</div>
    	<div class="AspNet-Login-RememberMePanel">
    		<input type="checkbox" id="_ctl0_cphRoblox_Login1_RememberMe" name="$ctl0$cphRoblox$Login1$RememberMe" accesskey="R" />
    		<label for="_ctl0_cphRoblox_Login1_RememberMe"><em>R</em>emember me next time.</label>
    	</div>
    	<div class="AspNet-Login-SubmitPanel">
    		<input type="submit" value="Log In" id="_ctl0_cphRoblox_Login1_LoginButton" name="$ctl0$cphRoblox$Login1$LoginButton" onclick="WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("_ctl0:cphRoblox:Login1:LoginButton", "", true, "_ctl0:cphRoblox:Login1", "", false, false))" />
    	</div>
    </div>
                </div>
            </div>
        
    <script type="text/javascript">
    <!--
    var Page_Validators =  new Array(document.getElementById("_ctl0_cphRoblox_Login1_UserNameRequired"), document.getElementById("_ctl0_cphRoblox_Login1_PasswordRequired"));
    // -->
    </script>
    
    <input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWBQKVpI+iBQKdpMitAQKPioDfDALj/oX2CwLoyc7yBfLlTe5VGUvyxPuXF923hVXmCBlG" />
    
    <script type="text/javascript">
    <!--
    var Page_ValidationActive = false;
    if (typeof(ValidatorOnLoad) == "function") {
        ValidatorOnLoad();
    }
    
    function ValidatorOnSubmit() {
        if (Page_ValidationActive) {
            return ValidatorCommonOnSubmit();
        }
        else {
            return true;
        }
    }
    // -->
    </script>
            
    <script type="text/javascript">
    <!--
    WebForm_AutoFocus('_ctl0_cphRoblox_Login1_UserName');// -->
    </script>
    </form>
    </body>
    </html>
    
     
    Friday, November 10, 2006 1:27 AM

All replies

  • User-534056067 posted

    Can you help me understand better what you mean when you say that you "declared a custom LoginProvider." Do you mean you set up a membership provider in your web.config?  That's exactly what the samples in this kit do.  They set up something I invented called the FakeMembershipProvider so the samples could do some simple validation stuff with users and passwords without needing a fancy database, etc.  See line 24 of http://www.asp.net/cssadapters/SrcViewer.aspx?inspect=~/web.config&notree=true.

    If you want to play around with a local copy of this kit so you can use the debugger, etc., to see how these samples work, see the instructions at http://www.asp.net/cssadapters/walkthru/walkthrough.aspx#RunLocally.

    Friday, November 10, 2006 5:49 PM
  • User-584780720 posted

    Yes, you guessed correctly. I should have said that I set up a membership provider in your web.config. My MembershipProvider works perfectly fine with the Login control if CSSFriendly is turned off. When I turn on CSSFriendly, then I get the problems described (and apparently no functions of my MembershipProvider are called)

    I hadn't noticed that CssAdaptersToturial also uses a custom MembershipProvider. I'll take some time to step through it. I'll let you know what I find (when I get to it!)

    Thanks for the suggestion, 

    -Erik

     

    Sunday, November 12, 2006 2:49 PM
  • User-2140226799 posted
    This still doesn't work in the RTM.  Sigh...  The one adapter I really wanted and it doesn't work properly.
    Thursday, November 23, 2006 12:31 PM
  • User-534056067 posted

    Hi Shazam999,

    Let's work together to try to solve the problem you are experiencing.  You say that the Login control doesn't work for you.  In order to help, I need a lot more detail.  Obviously this adapter kit has a sample of using an adapted Login control and it does work.  So, the first question to address is: how does your situation differ from that sample?

    I personally use these adapters on other sites so I know for a fact that they can work in "live" situations, not just samples. Let's try to figure out how your situation is different.  Maybe that will tell us what we need to do to change your configuration or to change the adapter code itself.  Remember, the kit comes with full source code so even if we have to modify the adapter we can do so in your site; you have full control over that.  But first we need to figure out why your situation isn't working, why it is different from those situations where things do work.

    Friday, November 24, 2006 12:50 PM
  • User-1221294036 posted
    I have a similar issue. Im using the adapters as well and this happens to me at the createuser method where it adds a user and then does a postback to the createuser page and causes an error that the email address has already been used. Im trying to figure out what is causing this.
    Monday, December 11, 2006 11:45 PM
  • User-534056067 posted
    Does this work properly if you do not use the adaptes?  You can temporarily "disable" the adapters by simply removing (temporarily) the .browser file found in App_Browsers.
    Wednesday, December 13, 2006 4:07 PM
  • User-1834467754 posted

    HI,

    I think i'm having the same problem http://forums.asp.net/thread/1485868.aspx, my "solution" found here http://forums.asp.net/1486503/ShowThread.aspx#1486503 fixed it for my login control, but i'm still having a problem with the recover password control.

    esc67: Can you confirm your postbacks are being called twice, can u put a breakpoint on your custom membership and debug it?

    BTW: I don't know if it matters but i have VS's sp beta 1...

    Regards,


     

     

     
     

    Thursday, December 14, 2006 8:14 PM
  • User-534056067 posted

    Can you post markup/code that would allow me to reproduce the problem here? Unfortunately, I need more than the markup for your CreateUserWizard tag.  I need a full recipe that would allow me to reproduce the problem without your whole web site, database, etc. Sorry, I know that's a lot to ask but I can't really get a handle on the problem otherwise. 

    Have you tried comparing what you are doing against what is being done in the online sample, http://www.asp.net/CSSAdapters/Membership/CreateUserWizard.aspx? I wonder why it seems to be OK. I'm sure there is a problem but I'm trying to understand why the sample didn't turn it up.

    Monday, December 18, 2006 5:39 PM
  • User-265662023 posted

    Hi, I realise that this thread is very old, but it's the closest I've found to the problem I'm experiencing with the CSS Friendly Login adapter.


    I have a standard Login control that I converted to a template and added/edited some features. This worked fine and I was able to login as expected. However, when I added the CSS Friendly adapters (latest build), I was suddenly unable to login. The requiredfield validation events etc still worked, but the login/membership stuff didn't - all I got was a plain page refresh. If I take out the CSS Friendly adapaters the conde works again, so it is definitely something associated with how the login control is amended. I've looked for a solution but can't find anything. Is this a known issue? Is there a workaround or have I just got to do something else to make things work?

    I put a breakpoint on Login1_loggedIn and Login1_LoginError. These are hit when the CSS Friendly adapters are not included in the project, but are not when the adapters are.


    My code:


    <asp:ValidationSummary ID="ValidationSummary1" runat="server" ValidationGroup="LoginGroup"
    ShowSummary="true" />
    <asp:Login ID="Login1" runat="server" DisplayRememberMe="False" OnLoggedIn="Login1_LoggedIn" OnLoginError="Login1_LoginError">
    <LayoutTemplate>
    <asp:Table ID="Table1" runat="server">
    <asp:TableRow>
    <asp:TableCell>Username:</asp:TableCell>
    <asp:TableCell>
    <asp:TextBox ID="UserName" runat="server" CssClass="RoundedInput" TabIndex="1" Width="250" />
    <asp:RequiredFieldValidator ID="RFVUsername" runat="server" ErrorMessage="You must enter a Username"
    ControlToValidate="UserName" ValidationGroup="LoginGroup" Display="None" />
    <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="UserName"
    ValidationExpression="[\S]*" ErrorMessage="Invalid Username. Must not contain space or tab characters."
    ValidationGroup="LoginGroup" Display="None" />
    <asp:CustomValidator ID="LoginValidator" runat="server" ControlToValidate="UserName"
    ValidationGroup="LoginGroup" />
    </asp:TableCell></asp:TableRow>
    <asp:TableRow>
    <asp:TableCell>Password:</asp:TableCell><asp:TableCell>
    <asp:TextBox ID="Password" runat="server" TextMode="Password" Width="250" CssClass="RoundedInput"
    TabIndex="2" />
    <asp:RequiredFieldValidator ID="RFVPassword" runat="server" ErrorMessage="You must enter a Password"
    ControlToValidate="Password" ValidationGroup="LoginGroup" Display="None" />
    <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" ControlToValidate="Password"
    ValidationExpression="[\S]*" ErrorMessage="Invalid Password. Must not contain space or tab characters."
    ValidationGroup="LoginGroup" Display="None" />
    </asp:TableCell></asp:TableRow>
    </asp:Table>
    <asp:Panel ID="ForgotPasswordPanel" runat="server">
    <p><asp:HyperLink ID="ForgotPasswordPageUrl" runat="server" NavigateUrl="~/PasswordRecovery.aspx">Forgotten password?</asp:HyperLink></p>
    </asp:Panel>
    <asp:Panel ID="RegisterPagePanel" runat="server">
    <p>No account? <asp:HyperLink ID="RegisterPageUrl" runat="server" NavigateUrl="~/Register.aspx">Register</asp:HyperLink> here.</p>
    </asp:Panel>
    <asp:Button ID="Login" CommandName="Login" ValidationGroup="LoginGroup" runat="server" Text="Submit" CssClass="RoundedButton" TabIndex="4" />
    <asp:Panel ID="ErrorLabelPanel" runat="server" CssClass="ErrorMessage" Visible="false">
    <p><asp:Label ID="ErrorLabel" runat="server" /></p>
    </asp:Panel>
    </LayoutTemplate>
    </asp:Login>

    Code behind:

    	protected void Login1_LoggedIn(object sender, EventArgs e) {
    if (SuccessfulLoginAction == SuccessfulLoginActions.RedirectToUrl) {
    //redirect here to over-rule the "return URL" property
    Response.Redirect(RedirectUrl);
    }
    }

    protected void Login1_LoginError(object sender, EventArgs e) {
    ClearErrorStatus();

    if (LoggedInUser == null) {
    UpdateErrorStatus("Username does not exist.");
    return;
    } else {
    //if account is awaiting authorisation
    if (!LoggedInUser.IsApproved) {
    UpdateErrorStatus(@"Your account has not been verified.
    Please check your email for your verification email and click on the verification link to activate your account.");
    return;
    }
    //if account is locked
    if (LoggedInUser.IsLockedOut) {
    UpdateErrorStatus(@"Your account has been locked following a number of failed login attempts.
    Please contact a site administrator to unlock your account.");
    return;
    }
    }
    //unable to determine error. show failure text.
    UpdateErrorStatus(Login1.FailureText);
    }


    I would really welcome any assisitance you can give. This has become really frustrating.


    Wednesday, January 20, 2010 12:11 PM
  • User-534056067 posted

    Are you using the DLL version of the CSS Adapter package or are you using the source code version? The DLL version was packaged up by the folks who run the CodePlex page for these adapters. When I originally created the adapters they were distributed at source code that you put in your App_Code folder, etc. This allowed you to debug stuff pretty easily. I'm not as familiar with the DLL way of integrating things.

    However, if you are using the DLL version, you could try to see if you could figure out how to put a break point into the LoginAdapter class' OnLoggedIn and OnLoginError methods. It would be interesting to see if you hit those. Maybe the problem is that they need to be modified to call base.OnLoggedIn and base.OnLoginError respectively... or something like that. 

    Wednesday, January 20, 2010 2:04 PM