Solved

RECAPTHA WITH VISUAL STUDIO LOGIN FORM

Posted on 2011-02-15
7
513 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 500 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
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 

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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

FAQ pages provide a simple way for you to supply and for customers to find answers to the most common questions about your company. Here are six reasons why your company website should have a FAQ 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 use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.

695 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