Bài đăng

Đang hiển thị bài đăng từ Tháng 8, 2018

Google reCaptcha v2 with MVC5, source: https://www.codeproject.com/Tips/894940/Google-reCaptcha-v-with-MVC

Download example - 5.5 MB Introduction The main purpose of this tip is to show a way of using the new Google reCaptcha plugin with MVC5. I think it would cover MVC4 as well. Background I was working on a project which required reCaptcha and the nuget plugin which seems to be the most documented in the old version. I couldn't find much on the new plugin, so I thought I should show how I came up with a solution. Using the Code To start, I signed up to reCaptcha and acquired my public and secret key. I added these to the  web.config  file. Hide     Copy Code < appSettings > < add key =" RecaptchaPrivateKey" value =" PRIVATEKEYHERE" / > < add key =" RecaptchaPublicKey" value =" PUBLICKEYHERE" / > < /appSettings > I then set out to display the reCaptcha plugin using an  HtmlHelper  extension. I pulled the public key from the  web.config  and sent back the HTML string. Hide     Copy Code