After successful registration, you will get a pair of keys to use with your ReCaptcha. Leave the page open or copy the keys to a text file, we will need them soon. We will use the contact form's template from the previous tutorial + we will add a reCAPTCHA element and a hidden input next to it to help us with the JavaScript validation. PHP: Protecting forms using a CAPTCHA Tweet 1 Share Share 0 Tweets 29 Comments. The CAPTCHA approach to securing forms is not new - it first appeared in the late 90's for domain name submissions to search engines and the like - but with the exponential growth of scripted exploits it's coming to the fore once again.
I have to add a contact form to a static website. I already got some experience with forms, done 2 or 3 using django/python, but sadly using django is not an option here, it has to be added to a static website. Could you please tell me what options do I have?
mmlnmmln1,47933 gold badges2020 silver badges2929 bronze badges
closed as off-topic by josliber♦, easwee, ketan, Anand S Kumar, Sudharsan SJul 2 '15 at 7:44
This question appears to be off-topic. The users who voted to close gave this specific reason:
- 'Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.' – josliber, easwee, ketan, Anand S Kumar, Sudharsan S
11 Answers
You could set up a Google Docs form to mimic a contact form and include the form into your website by using the snippet that Google tells you for your form.
By using notification rules you can get automatic notifications, every time someone fills out the form.
Uwe KeimUwe Keim28k3232 gold badges140140 silver badges223223 bronze badges
Have a look at Form Spree, you can simply add a
<form>
with an action posting to their service, and get an email each time someone fills the form.Very efficient!
(Not suited for contact forms with a lot of submissions. Consider Wufoo or the shiny new FormKeep)
Sébastien SaunierSébastien Saunier
If you are looking for a simple solution it doesn't get much easier than fwdform. I wrote it myself when I needed quick and dirty contact form processing on my own static site.
To get your form forwarded to your email you just need to do the following.
1.Register
Make an HTTP POST request to register your email.
2. Set up your form
You can even run it on your own Heroku instance if you prefer not to trust a third-party service.
sdobsonsdobson
One solution is to use qontacto . it is a free contact form you can add to any website. it forwards you the messages.
Marcelo BiffaraMarcelo Biffara
There's a similar question here.
The solution was to point to a PHP file on a different server, one that isn't static. knittl shows how to point the action attribute to a different server.
One other alternative would be to use Wufoo forms, which you can embed in a static page.
Community♦
derekdacderekdac
Another option would be to use an iframe to sneak your dynamic form into the site.
Andrew BaconAndrew Bacon
I just found a new answer to this question (and actually i find it the best one in some cases):
You can use podio.com which is a free (up to 5 members in one organisation) ERP
(Enterprise resource planning (ERP) systems integrate internal and external management information across an entire organization. (via wikipedia))
, that allows creation of fully customizable webform, that can be added anywhere you wish. What's more, the input that your webform gathers can be easily managed: for example added into you contact list, added to tasks so you can check wether you or someone from your team handled enquiries. More on that here: http://blog.podio.com/2012/08/07/styleyourwebform/some pros:
- can be added anywhere you wish (you just have to specify subdomains its going to be used on)
- you can customize form in minutes
- you can add captcha (or some other spam protection) with one click
- you can easily manage webform leads
cons:
- youd have to create a podio acc for every client you want to set up webform for in order to avoid sharing confidential info
1,47933 gold badges2020 silver badges2929 bronze badges
You can better use
UserVoice
contact form. Uservoice
will do two things- It will create new ticket inside
Uservoice
system. - It also send a mail to you.
It will be end to end solutions for customer support. However if you send mail through some services, you have to communicate to your customer for support.
Uservoice
will designed and built for customer support only. I know, you have a questions that you want to use your own custom form, not the one provided as uservoice widget. Yes, you can do it by
Fizer KhanFizer Khan36.9k2424 gold badges119119 silver badges136136 bronze badges
The page can be static HTML, but your action can point to a PHP or similar file.
Andrew BaconAndrew Bacon
Another alternative is to use free hosted forms from a service such as Tectite. You push your forms to their service then they email you the results.
tatsuhirosatoutatsuhirosatou9,7591212 gold badges3333 silver badges3737 bronze badges
If you're using Octopress or Jekyll for your static site. You might want to check out jekyll-contact: https://github.com/anchetaWern/jekyll-contactIt uses pooleapp for sending the contents of your contact form to an email you specify.
Wern AnchetaWern Ancheta7,9433535 gold badges8282 silver badges130130 bronze badges
Not the answer you're looking for? Browse other questions tagged htmlcssformscontact or ask your own question.
How do I implement reCaptcha in ASP.NET MVC and C#?
George Stocker♦46.4k2929 gold badges157157 silver badges220220 bronze badges
xportxport3,1871111 gold badges4343 silver badges8383 bronze badges
closed as too broad by Samuel Liew♦Apr 6 '18 at 12:08
Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
8 Answers
There are a few great examples:
- Using ReCaptcha with ASP.NET MVC by Derik Whittaker
- MVC reCaptcha - making reCaptcha more MVC'ish.
- ReCaptcha Control for ASP.NET MVC from Google Code.
This has also been covered before in this Stack Overflow question.
NuGet Google reCAPTCHA V2 for MVC 4 and 5
Community♦
George Stocker♦George Stocker46.4k2929 gold badges157157 silver badges220220 bronze badges
I have added reCaptcha to a project I'm currently working on. I needed it to use the AJAX API as the reCaptcha element was loaded into the page dynamically. I couldn't find any existing controls and the API is simple so I created my own.
I'll post my code here in case anyone finds it useful.
1: Add the script tag to the master page headers
2: Add your keys to the web.config
3: Create the Action Attribute and Html Helper extensions
4: Add the captcha to your view
5: Add the attribute to your action
6: Note you will need to reload the captcha after each post even if it was valid and another part of the form was invalid. Use
Recaptcha.reload();
![Html Html](/uploads/1/2/4/6/124692086/718455076.png)
3,5941212 gold badges4444 silver badges6060 bronze badges
Simple and Complete Solution working for me.Supports ASP.NET MVC 4 and 5 (Supports ASP.NET 4.0, 4.5, and 4.5.1)
Step 1: Install NuGet Package by 'Install-Package reCAPTCH.MVC'
Step 2: Add your Public and Private key to your web.config file in appsettings section
You can create an API key pair for your site at https://www.google.com/recaptcha/intro/index.html and click on Get reCAPTCHA at top of the page
Step 3: Modify your form to include reCaptcha
Step 4: Implement the Controller Action that will handle the form submission and Captcha validation
OR
MojiMoji3,51122 gold badges2828 silver badges3131 bronze badges
An async version for MVC 5 (i.e. avoiding ActionFilterAttribute, which is not async until MVC 6) and reCAPTCHA 2
ExampleController.cs
ExampleView.cshtml
RecaptchaServices.cs
web.config
BrentBrent2,67922 gold badges2626 silver badges3535 bronze badges
I've successfully implemented ReCaptcha in the following way.
note: this is in VB, but can easily be converted
note: this is in VB, but can easily be converted
1] First grab a copy of the reCaptcha library
2] Then build a custom ReCaptcha HTML Helper
3] From here you need a re-usable server side validator
above this line is reusable **ONE TIME** code
below this line is how easy it is to implement reCaptcha over and over
Now that you have your re-usable code... all you need to do is add the captcha to your View.
And when you post the form to your controller...
Chase FlorellChase Florell31.2k4646 gold badges157157 silver badges342342 bronze badges
Step 1: Client site integration
Paste this snippet before the closing
</head>
tag on your HTML template:Paste this snippet at the end of the
<form>
where you want the reCAPTCHA widget to appear:Step 2: Server site integration
When your users submit the form where you integrated reCAPTCHA, you'll get as part of the payload a string with the name 'g-recaptcha-response'. In order to check whether Google has verified that user, send a POST request with these parameters:
URL : https://www.google.com/recaptcha/api/siteverify
secret : your secret key
response : The value of 'g-recaptcha-response'.
Now in action of your MVC app:
![Captcha Captcha](/uploads/1/2/4/6/124692086/756992860.png)
36.1k1010 gold badges7979 silver badges121121 bronze badges
Thinh VuThinh Vu2,00811 gold badge88 silver badges77 bronze badges
For anybody else looking, here is a decent set of steps. http://forums.asp.net/t/1678976.aspx/1
Don't forget to manually add your key in OnActionExecuting() like I did.
PatPat
Extending Magpie's answer, here is the code for action filter which I use in my project.
It works with ASP Core RC2!
And use it in your code like
Dmytro BogatovDmytro Bogatov47411 gold badge66 silver badges1515 bronze badges