Recaptcha V2 under classic ASP

Here’s a quick primer on upgrading your Classic ASP site Recaptcha V1 to V2.

First, go to Google Recaptcha online and generate yourself a v2 pair of keys for your site’s domain.

Next:

On the page with the “FORM” on it on which you want to display the Recaptcha V2.

Add to the HEADER (inside the HEAD TAGS):

<script src='https://www.google.com/recaptcha/api.js'></script>

 

Replace the existing code which renders your v1 recaptcha with this line:

<div class="g-recaptcha" data-sitekey="put your google public v2 key here" ></div>

 

on your FORM SUBMIT page (where the v2 form gets submitted to):

Inside ASP tags, place this line:

Response.LCID = 1033 ' USA LCID

It is a required element for the JSON Parser.

Inside the HEAD:

<!--#include file="jsonObject.class.asp" -->

 

you can get this file from my site HERE

now the processing code to handle the Recaptcha JSON response:

 

If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
 Dim recaptcha_secret, sendstring, objXML
 
 recaptcha_secret = "your secret key goes here"

 sendstring = "https://www.google.com/recaptcha/api/siteverify?secret=" & recaptcha_secret & "&response=" & Request.form("g-recaptcha-response")

 Set objXML = Server.CreateObject("MSXML2.ServerXMLHTTP")
 objXML.Open "GET", sendstring, False

 objXML.Send
 
 set jsonObj = new JSONobject
 set jsonArr = new jsonArray


 jsonString = objXML.responseText
 
 set outputObj = jsonObj.parse(jsonString)  
 
 
 if jsonObj.value("success") then
  Global_Msg="Captcha GOOD!"
 else
  Global_Msg="Invalid Recaptcha Response."
 end if
 
 Set objXML = Nothing
End If

if Global_Msg<>"Captcha GOOD!" then
%>
invalid RECAPTCHA response.  Hit back and try again.
<%
response.end

end if

 

For your convenience, here is all the code inside one ZIP file.

 

Let me know if this helped you!

 

 

Cannot browse network neighborhood under Windows 10 Fall Creators update 1709 and newer

Once again, Microsoft has thrown a monkey wrench into the operation of how your network neighborhood (or “Network”) item under Windows 10 works.

I had previously created this blog post which addressed the initial issues with Windows 10 not allowing the Network to show a list of all your local computers.

Well, due to the Fall Creators update and versions 1709 and later, Microsoft has moved even further to stop the use (and functionality) of the Network icon inside windows explorer.

Microsoft has completely disabled (and removed) SMBv1 in Windows 10 (and modern Windows Server 2016) starting with the FALL CREATORS UPDATE build 1709 and later.   This in-effect completely disables the ability for your NETWORK item in Windows Explorer to populate a list of your local network computers.

I manage several small networks and it is EXTREMELY helpful to be able to browse a list of all the local computers.

To fix this issue, go to WINDOWS FEATURES (just use Cortana and type in windows features), expand SMB 1.0/CIFS File Sharing Support

CHECK: SMB 1.0/CIFS CLIENT and SERVER

click OK

it will prompt you to reboot

when you’ve rebooted, go to windows file explorer and click on NETWORK.  you may need to hit the refresh icon, but it should pull the list of all local PC’s and magically your network neighborhood will now work!

 

**Note: if you try this and it still doesn’t work, make sure you do the registry entry on my prior blog post (link at the top of this post).  You will need to add that registry key and reboot.

 

1080p HDTV as second monitor display blinks on and off while watching video

I have a second monitor which is a Philips 1080p 40 inch TV (that I switch the HDMI inputs to alternate between cable and a second monitor).

When I play streaming video from YouTube on the monitor, the display blinks on and off continuously.  This does NOT happen when using the Philips for TEXT displays (outlook, explorer, etc.)

The fix is easy.

First, make sure your second monitor (HDTV) is in “PC” mode. (This is not the fix in itself).

Secondly, I have the most current NVIDIA drivers installed.

Go to NVIDIA CONTROL PANEL (right click on an empty desktop)

Click ADJUST DESKTOP COLOR SETTINGS

click on your secondary monitor name (in my case, PHILIPS)

You will see a dropdown box appear.

Set “content reported to the desktop” to “Desktop Programs”.

 

That’s it.

Your secondary monitor should now be rock stable while watching videos.

 

let me know if this helped you!

sprintf or printf do not output float variables correctly

Have you run into situation under the MPLAB IDE where you are trying to output variables, but even though you have the format correct, a float variable outputs with a .0 value?

Example

(from somewhere else in code)
AIRTEMP=751
====
float adjustedtemp= 0.0;
adjustedtemp= (AIRTEMP + 5)/10;
printf("Air Temp: %5.2f \r\n", adjustedtemp);

the result looks like this

Air Temp: 75.00

when it SHOULD look like this

Air Temp: 75.60

this is due to a bug in the way MPLAB handles floats.

Two easy ways to fix it:

#1:

adjustedtemp= (AIRTEMP + 5.0)/10.0;

or,

#2

adjustedtemp= ((float)AIRTEMP + 5)/10;

Either of these methods will result in the correct value being displayed during your sprintf() or printf() command.

Coldfusion 10 and Windows Server – Installation Musings

Here are some various tips and tricks as part of my brain dump for the process to get ColdFusion 10 running under Windows Server 2016.

  1. Run the ColdFusion installer under compatibility mode – Windows 7
  2. you must have the following installed under IIS
    1. CGI, ISAPI (both), ASP.NET
  3. make sure the APPPOOL for the site has 32 bit compatiblity to TRUE under app pool – advanced settings
  4. immediately after installing CF, you need to go download the latest hotfix (version 24 as of June 2017) and install it.  Directions are here
  5. Read this – it’s VERY important.
    1. you must create the two virtual directories CFIDE and JAKARTA and point them to the correct folders.
    2. NOTE: on my system, the default site was SITE ID #1 and the first actual CF site was ID #2.  However, the only way that CF would work was for me to point the jakarta directory to “1” (the default site)…
  6. Get friendly error messages->
    1. CF admin, Settings, UNCHECK “Enable HTTP status codes
  7. debug your website easily… (do #6) and then:
    1. CF admin, Debugging and Logging
      1. CHECK “Enable Robust Exception Information”
      2. CHECK “Enable Request Debugging Output”
      3. Debugging & Logging > Debugging IP Addresses
        1. add your workstation’s IP address to this list
      4. NOTE:  Make sure you TURN OFF these settings before going live on a public site
    2. Refresh your CF pages and a boat load of debugging info should show up at the bottom of each page
  8. Mail configuration is under Settings>Mail, if your website needs it.

Any other questions/comments?  Let me know!

Coldfusion with PostgreSQL – Timeout issue when setting up CF Data source

Upon trying to connect to a remote POSTGRESQL database server — which I can both PING fine and connect to using the Windows POSTGRESQL odbc 32 bit drivers —

you get this error

Connection verification failed for data source: mytest_post
java.sql.SQLException: Timed out trying to establish connection
The root cause was that: java.sql.SQLException: Timed out trying to establish connection

==

Here is the easy fix.  (presumtion of CF 10)

  1. make sure you apply the most current CF hotfix
    1. easy process – read this blog post
  2.  for an “out-of-the-box” setup, (noting that CF 10 is running on JRE 6.x), download the JDBC driver version 4.0 (which is for JRE 6.x)  here
  3.  put that JAR file in the following directory
    1. C:\ColdFusion10\cfusion\lib
    2. remove the old POSTGRESQL JAR file postgresql-9.3-1101.jdbc41.jar
    3. restart the CF services
  4. Go setup the postgreSQL connection and verify it.  Should now give you an “OK”

This was a NIGHTMARE to sort out.  I am hoping this can help someone!

 

XC8 compiler installer hangs on installation

If you are having a problem with the MICROCHIP XC8 installer hanging on installation under Windows 10 — (see screenshot below):

 

Very easy solution…

 

Change your screen resolution to 1080p, and TURN OFF all “screen scaling/screen zooming” settings

Reboot your computer (trust me, just do this step)

The installer should work fine now.

when done, change your screen back to whatever settings you previously had it at…

let me know if this works for you.  I spent 2 hours trying to figure this one out.

 

Classic ASP switch to TLS 1.2

I recently came across a failed PCI scan for one of our clients.  This failure was due to TLS 1.0 being enabled on that Windows server.

We ran IISCRYPTO (link) and disabled TLS.

Upon restarting the server, the Classic ASP site threw the following error:

Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC SQL Server Driver][DBNETLIB]SSL Security error

That error is because the web server is no longer using TLS 1.0 and the Classic ASP application (web site) is using too old of a driver on the server, to communicate with TLS 1.1 and/or 1.2.

To get around this, go download the latest ODBC driver from Microsoft, which is version 13.1 as of today.  You will most likely need to install the 32-bit version (as most ASP apps run in 32 bit mode).  Link here

Install that driver.

then go to your Windows server, Administrative tools and open the ODBC Data Sources (32-bit)

The 32-bit ODBC Administrator is found here: C:\Windows\SysWOW64\odbcad32.exe

go to the SYSTEM tab

add a new data source

Pick “ODBC DRIVER 13 for SQL Server”… (hit finish)

 

put in the name (no spaces or punctuation)

server name (or IP address) (NEXT)

 

authentication (USE SQL server auth, enter the LoginID and PW) (NEXT)

 

continue, then test the connection (it should work).

go to your Classic ASP application.

 

 

You will need to update the connection string to this:

DSN=YourNewSystemDSNName;Uid=YourSQLUsernameHere;Pwd=SQLpassword;

You can now use IISCrypto and disable TLS 1.0

Reboot the server

re-test your Classic ASP app and now you should be up and running on TLS 1.1 or 1.2

 

 

 

 

1 2 3 9