Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

RECAPTHA WITH VISUAL STUDIO LOGIN FORM

Posted on 2011-02-15
7
Medium Priority
?
520 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
[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
  • 4
  • 3
7 Comments
 
LVL 27

Expert Comment

by:BigRat
ID: 34905479
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
ID: 34907128
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 2000 total points
ID: 34907340
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
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 

Author Comment

by:bidgadget
ID: 34907440
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
ID: 34909174
>>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
ID: 34909250
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
ID: 34909355
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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
Ever visit a website where you spotted a really cool looking Font, yet couldn't figure out which font family it belonged to, or how to get a copy of it for your own use? This article explains the process of doing exactly that, as well as showing how…
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

618 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