Closed RickTheHat closed 4 years ago
Your form has to be a post
form:
<form method="post">
...
</form>
In your controller you'll have to add the [SpamProtection]
attribute. See:
https://github.com/danielpalme/MVCBlog/blob/master/src/MVCBlog.Web/Controllers/BlogController.cs#L153
very odd as it does have that but I'll start from scratch from a clean core mvc and add your files to see if it's perhaps a competing nuget package.
https://github.com/RickTheHat/SpamProtectionDemo, here's a clean mvc core 3.1 project with minimal code. could you take a peek when you get a chance, I must be missing something. I do see it's working on your site but not working when I go to mine https://localhost:5001/NewsletterMembers/Create ... TX
I have sent you a PR (https://github.com/RickTheHat/SpamProtectionDemo/pull/1).
The spam protection is only active for POST forms. The method="post"
attribute was missing in your view.
Thanks Daniel, I was looking at the "method=post" after the page loaded and not while at rest. Many thanks for the code, it's helped me a lot on my Diners, Drive-ins and Dives website https://www.flavortownusa.com where I get a ton of spam submissions every day.
I have implemented your spam protection to my asp.net core 3.1 project but it's not building the
<input type="hidden" name="SpamProtectionTimeStamp" value="1592192250" />
as it does on your site.I'm not sure how to provide a bug as nothing shows up on my contact for but I am mirroring what's going on in your MVCBlog.
Do you know of something else I could try and look at? perhaps I'm missing something?
I'm using both Spam files in a /Helpers directory in a single project so my _ViewImports.cshtml file looks like this:
@addTagHelper MySite.Helpers.SpamProtectionTagHelper, MySite