Solved

RECAPTHA WITH VISUAL STUDIO LOGIN FORM

Posted on 2011-02-15
7
499 Views
Last Modified: 2012-06-27
I am using asp.net 4 with visual studio.  I am just using the simple login form that comes with the website install.  I want to use recaptha with it.  I downloaded and did everything they ask for to install and the recaptha picture looks good on the login form but it accepts any word I put in.  My guess is that it is not validating it because of my code.  I have included my code to the login.asp form and any help would be appreciated.
<%@ Register TagPrefix="recaptcha" Namespace="Recaptcha" Assembly="Recaptcha" %>

<%@ Page Title="Log In" Language="VB" MasterPageFile="~/Site.Master" AutoEventWireup="false"
    CodeFile="Login.aspx.vb" Inherits="Account_Login" %>

<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
    <h2>
        Log In
    </h2>
    <p>
        Please enter your username and password.
        <asp:HyperLink ID="RegisterHyperLink" runat="server" EnableViewState="false">Register</asp:HyperLink> if you don't have an account.
    </p>
    <asp:Login ID="LoginUser" runat="server" EnableViewState="false" RenderOuterTable="false">
        <LayoutTemplate>
            <span class="failureNotification">
                <asp:Literal ID="FailureText" runat="server"></asp:Literal>
                 <recaptcha:RecaptchaControl     ID="recaptcha"     runat="server"     PublicKey="6LcFuL0SAAAAAMRPUHEkLicXVQwGNN-yywkvXSDN"     PrivateKey="6LcFuL0SAAAAAPeam9siNDf0Mc3i5T02hc5j_EKc"     />
            </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>
                        <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="submitButton">
                    <asp:Button ID="LoginButton" runat="server" CommandName="Login" Text="Log In" ValidationGroup="LoginUserValidationGroup"/>
                    <recaptcha:RecaptchaControl     ID="RecaptchaControl1"     runat="server"     PublicKey="6LcFuL0SAAAAAMRPUHEkLicXVQwGNN-yywkvXSDN"     PrivateKey="6LcFuL0SAAAAAPeam9siNDf0Mc3i5T02hc5j_EKc"     />
              
                </p>
            </div>
        </LayoutTemplate>
    </asp:Login>
    
    
</asp:Content>

Open in new window

0
Comment
Question by:bidgadget
  • 4
  • 3
7 Comments
 
LVL 27

Expert Comment

by:BigRat
Comment Utility
According to http://code.google.com/intl/de/apis/recaptcha/docs/aspnet.html there should be a FORM on your page, which I don't  see. Secondly there are TWO recaptura controls on the page?

I'd stick exactly to the example given on the web site, since it seems that the control expects to have things it's way.
0
 

Author Comment

by:bidgadget
Comment Utility
Thank you for respoinding.  I tried to put a form tag but I get a error message saying a form can have only one form tag.  Although I do not see another.  In your link you sent I am not sure how to complete step 3.

Thank you
0
 
LVL 27

Accepted Solution

by:
BigRat earned 500 total points
Comment Utility
Well it is probably the case that the asp:Login produces the actual HTML form tag, but since this is not present at server time the captura control cannot link to it (presumably, since I have no idea how it is actually inplemented).

I see that the control has NOT been updated for .NET 2 which you are using, and subsequently you'll have to either modify the control or add a custom validator. This web site shows up the issues :-

http://stackoverflow.com/questions/231344/how-to-make-recaptcha-work-with-a-validationgroup-in-asp-net-captcha

It seems that adding a custom validator is the best way to go.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:bidgadget
Comment Utility
I am using asp.net 4

Looks like this is not the right idea for me for multi factor authenication.   Would you recommend any other captha programs?
0
 
LVL 27

Expert Comment

by:BigRat
Comment Utility
>>I am using asp.net 4

The control is certainly not ASP 4 compatible. But I don't see why adding a custom validation is a problem? Here is the example :-

http://www.15seconds.com/issue/050216.htm
0
 

Author Comment

by:bidgadget
Comment Utility
we have to have dual authenication on our website.  I am not really a programmer so I was looking for something that would work with the already setup asp login that comes with visual studio
0
 
LVL 27

Expert Comment

by:BigRat
Comment Utility
Hmmm, I don't really know. You'll probably have to shop around. This might work, it needs at least to be ASP:NET 2 compatible for the Group Validation to work.

http://captcha.biz/asp.net-captcha.html
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Many companies are making the switch from Microsoft to Google Apps (https://www.google.com/work/apps/business/). Use this article to learn more about what Google Apps has to offer and to help if you’re planning on migrating to Google Apps. It is …
Any business that wants to seriously grow needs to keep the needs and desires of an international audience of their websites in mind. Making a website friendly to international users isn’t prohibitively expensive and can provide an incredible return…
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.

771 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now