Solved

Login Control Issue

Posted on 2010-09-16
10
512 Views
Last Modified: 2012-05-10
I am using a custom template - shown in the code sample below - to host a Login control for an ASP.NET website.  If the Remember Me Next Time box is checked, I wanted the Username and Password fields pre-populated the next time a user comes to this page but that does not work.  

Not only does that not work, but the Password Manager in all browsers does not recognize these fields as a from and thus none of them offer to remember the password for me.  You cannot click on the textbox to get old usernames, etc...

I did verify that a cookie is being created upon login but it is not being utilized the next time through.

My web.config file already contains a machine key and uses the following froms entry:

<forms defaultUrl="Secure/Home.aspx" loginUrl="~/Login.aspx" name=".ASPXAUTH" path="/" protection="All" timeout="500000" slidingExpiration="true"/>

Can somebody please help me figure out what I am doing incorrectly?
<asp:Login ID="Login1" runat="server" RememberMeSet="True" Width="100%" OnLoggedIn="Login1_LoggedIn"
        OnLoginError="Login1_LoginError" ViewStateMode="Enabled" EnableViewState="true" onloggingin="Login1_LoggingIn">
        <LayoutTemplate>
            <asp:Literal ID="litFinishIt" runat="server" />
            <table border="0" cellpadding="0">
                <tr>
                    <td colspan="2">
                        <h2>
                            Welcome Users!</h2>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <asp:Literal ID="litSpecial" runat="server" />
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        <asp:Label ID="UserNameLabel" runat="server" AssociatedControlID="UserName" CssClass="formLabel">Email Address:</asp:Label>
                    </td>
                    <td>
                        <asp:TextBox ID="UserName" CssClass="textBoxClass" runat="server" TabIndex="0"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="UserNameRequired" runat="server" ControlToValidate="UserName"
                            ErrorMessage="User Name is required." ToolTip="User Name is required." ValidationGroup="Login1">*</asp:RequiredFieldValidator>
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        <asp:Label ID="PasswordLabel" runat="server" AssociatedControlID="Password" CssClass="formLabel">Password:</asp:Label>
                    </td>
                    <td>
                        <asp:TextBox ID="Password" CssClass="textBoxClass" runat="server" TextMode="Password"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="PasswordRequired" runat="server" ControlToValidate="Password"
                            ErrorMessage="Password is required." ToolTip="Password is required." ValidationGroup="Login1">*</asp:RequiredFieldValidator>
                    </td>
                </tr>
                <tr>
                    <td></td>
                    <td>
                        <asp:CheckBox ID="RememberMe" runat="server" Text="Remember me next time." TabIndex="2" />
                    </td>
                </tr>
                <tr>
                    <td></td>
                    <td>
                        <asp:Literal ID="ErrorMessage" runat="server" EnableViewState="False"></asp:Literal>
                        <asp:ImageButton ID="LoginButton" runat="server" ImageUrl="images/button_login1.gif"
                            Width="102" Height="31" CommandName="Login" AlternateText="Log In" ValidationGroup="Login1" /><br />
                        <br />
                    </td>
                </tr>
                <tr>
                    <td></td>
                    <td>
                        <a href="PasswordRecovery.html">Forgot Your Password?</a>
                    </td>
                </tr>
            </table>
            <asp:ValidationSummary ID="ValidationSummary1" runat="server" ShowMessageBox="True"
                ValidationGroup="Login1" ShowSummary="False" />
        </LayoutTemplate>
    </asp:Login>

Open in new window

0
Comment
Question by:ktola
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 5
10 Comments
 
LVL 41

Expert Comment

by:guru_sami
ID: 33693739
-->If the Remember Me Next Time box is checked, I wanted the Username and Password fields pre-populated the next time a user comes to this page but that does not work.  

Not, that is not the purpose of Remember Me. It's purpose is to automatically login based on the cookie. It does not keep your username/password.

To do that you will have to manually create a separate cookie to store those values. Then when they come to Login page, grab those values and populate the textboxes.
To get the username and password textboxes in code-behind, you will have to do findControl i.e Login1.FindControl("UserName").

Note: It is not a good idea to store passwords in cookie. You might want to consider all security aspects before going this route.
0
 

Author Comment

by:ktola
ID: 33693759
Fair enough but the auto-login feature does not work either and why are none of the browsers recognizing this form as a form?
0
 
LVL 41

Expert Comment

by:guru_sami
ID: 33693965
Just wondering if you have settings to clear history upon browser closing and that is wiping out the cookie?
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 

Author Comment

by:ktola
ID: 33694087
That browsers automatically remember usernames and password for other sites - just not this one for some reason I do not understand.
Also, if you use IE, you know that using the same textbox name on different sites will enable IE to prepopulate that textbox with options.  You click on the textbox and those options appear.  That also does not work here and I have no idea why...
0
 
LVL 41

Expert Comment

by:guru_sami
ID: 33694205
I doubt if it is because TextBoxes are inside of Login Control but for test purpose, can you place a Textbox on the same page as Login control and see if that is remembering the value to prepopulate.
0
 

Author Comment

by:ktola
ID: 33694237
I actually created a page with just a standard Login control - no template, no fancy anything - and that does not work either.
I have other sites I have built with a standard Login control that have never had this issue
0
 
LVL 41

Expert Comment

by:guru_sami
ID: 33694443
-->I actually created a page with just a standard Login control - no template, no fancy anything - and that does not work either.

I see...I tried just now placing a login control on a page and it worked in IE8 and FF.

Is your browser remembering everything from other sites and just not this one guy?



0
 

Author Comment

by:ktola
ID: 33694465
That is correct - but I already wiped out the Registry settings and it made no difference
0
 
LVL 41

Accepted Solution

by:
guru_sami earned 500 total points
ID: 33694712
Check if the explanation provided here by hans_v on - how Remember Me works - helps:
http://forums.asp.net/p/999452/1314477.aspx#1314477

For the browser not remembering form data just for this one application....I have no idea.
0
 

Author Closing Comment

by:ktola
ID: 33753682
THank you for the link to getting Remember Me Next Time to work.  It still did not help with the current website but it provided some useful insights nonetheless.  I am not sure what is going on but it is clear that it is my code and not a shortcoming of the Login control...
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Do you come here a lot? Are you lazy like me and don't want to go through the "trouble" of having to click your Dock's Safari icon and then having to click your Experts Exchange Favorites bookmark to get here? Well then this article is for you.
SSL stands for “Secure Sockets Layer” and an SSL certificate is a critical component to keeping your website safe, secured, and compliant. Any ecommerce website must have an SSL certificate to ensure the safe handling of sensitive information like…
Google currently has a new report that is in beta and coming soon to Webmaster Tool accounts. This Micro Tutorial will highlight new features for Google Webmaster Tools.
This Micro Tutorial will demonstrate how to add subdomains to your content reports. This can be very importing in having a site with multiple subdomains.

632 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question