Posts

Showing posts from 2019

Using ReCaptcha v2 Insible in MVC Net Core 2 Applications

Suppose There is only one form in the page The form will be submitted in a way that can fire the the onsubmit event like either of the following: <input type="submit" value="Submit" /> <button type="submit">Submit</button> You can not submit a form in a way that can bypass the onsubmit event like the following (because the direct invocation of submit() will not fire the onsubmit event): <button type='button' onclick='getElementById("myForm").submit();'>Submit</button> The flow Clicking on submit -> Model client validation by jquery.validate -> reCaptcha client validation by grecaptcha.execute() -> (reCaptcha puzzle challenges if any) -> submitted by reCaptcha data-callback -> Model server validation -> reCaptcha server validation -> done Only after the reCaptcha client side validation has been passed, the form has chance to reach the back end. However, the ReCapt

Using ReCaptcha v3 in MVC Net Core 2 Applications

/Views/Shared/_reCaptcha.cshtml @using Microsoft.Extensions.Configuration @inject IConfiguration _configuration <script src="https://www.google.com/recaptcha/api.js?render=@_configuration.GetSection('Recaptcha_v3')['SiteKey']"></script> grecaptcha.ready(function () { var $form = getForm(); if ($form.length == 0) { $(".grecaptcha-badge").hide(); } else { $form.on("submit", function(e){ e.preventDefault(); submitWithUserResponseToken($form); }); } }); function getForm() { return $("form").eq(0); } function submitWithUserResponseToken($form) { if ($form.length > 0) { grecaptcha.execute('@_configuration.GetSection("Recaptcha_v3")["SiteKey"]', { action: $form.attr('name') }).then

Learning GIT

Setting up a repository Version Controlling with Git in Visual Studio Code and Azure DevOps

Handler "aspNetCore" has a bad module "AspNetCoreModuleV2" in its module list

In my project, I use the newest Net Core 2.2, but I got the error: HTTP Error 500.21 - Internal Server Error Handler "aspNetCore" has a bad module "AspNetCoreModuleV2" in its module list My Web.Config <?xml version="1.0" encoding="utf-8"?> <configuration>   <location path="." inheritInChildApplications="false">     <system.webServer>       <handlers>         <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule V2 " resourceType="Unspecified" />       </handlers>       <aspNetCore processPath=".\xxx.exe" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout">         <environmentVariables>           <environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" />         </environmentVariables>       </asp

Quick Start: NVDA

Common Keys Start NVDA: Ctrl+Alt+n or Start Menu/NVDAc NVDA key: Insert or Caps Lock NVDA Menu: NVDA + n Quit NVDA: NVDA + q Stop speech: Control Pause Speech: Shift Read current line: NVDA + Up Arrow Read next line: NVDA + Down Arrow Toggle browse/focus modes: NVDA + space Single Letter Navigation: h: heading 1 to 6: headings at levels 1 to 6 respectively Browse mode elements list (show available action list): NVDA + F7 https://www.nvaccess.org/files/nvda/documentation/userGuide.html?#LaunchingNVDA Known Issues "Clickable Clickable Clickable …" Please note that NVDA has a well known issue or bug: Sometimes you might hear a lot of repeated speech “Clickable Clickable Clickable …”, very annoying: This is by design of NVDA. So good solution so far. You can turned of by pressing NVDA+n/Preferences/Settings/Document Formattting/Uncheck “Clickable”. For details, please refer to: User Group discussion: https://nvda.groups.io/g/nvda/topic/stopping_the

My Tool: Using Gulp and Powershell to Automate File Uploading and Approval for SharePoint 2010

Usges Automate uploading all changed files to SharePoint c:\dev\wan\MyProject\gulp default or c:\dev\wan\MyProject\gulp spdefault Automate appoving all files in SharePoint c:\dev\wan\MyProject\gulp approveall Automate checking in all files in SharePoint c:\dev\wan\MyProject\gulp checkinall Automate checking out all files in SharePoint c:\dev\wan\MyProject\gulp checkoutall Note Please ensure Powershell version must be at least 4 ! ($PSVersionTable.PSVersion) To Map Network Drive, WebDAV must be installed (Server Feature/Desktop Experience/Restart Server, enable WebClient service) if the mapped drive Z: is not recognized in powershell or command line, please "net use Z: http://pre.dev.com " instead Please login to Z: first else copying will fail due to no access  Content of c:/dev/wan/MyProject/gulpfile.js // https://www.spdavid.com/use-gulp-and-npm-to-automate-2/ // For SP2013 and SP 2016: https://www.definitivelogic.com/2017/02/21/legacy-sharepoin