Monday, June 07, 2010

Dealing with invalid Certificates

Well, I’ve been working on a project that sends out large amounts of emails. It’s one of those projects that works fine in development, makes it through the test environment fine then BOMBS in production. It turned out that the systems was failing due to an invalid certificate. The certificate being used by the email server had expired months ago and nobody noticed.

While the Server guys were busy getting a new certificate, I implemented a quick fix to get the application working.

The fix involves setting up a call back used for Certificate Validation, very easy. Below is a sample (just Validates any request).


After the call back is setup, it’s just a matter of ensuring it gets called.


And that’s it. Problem solved.

Obviously in the call back you’d actually check the error and only validate the certificate for the specific error you want to, but as an example, this works a treat.


I didn’t know…

that you could use the keyboard shortcuts Ctrl + Tab in visual studio to switch between tabs. Better yet, it brings up a little dialog box that allows you to visually see the tabs you have open complete with a preview.


Visual Studio 2010 unfortunately has the preview turned off by default (due to a reported performance issue right before release on slow netbooks). To enable the preview, just run the following command from a command line (or Start –> Run).

“reg ADD HKCU\Software\Microsoft\VisualStudio\10.0\General /v ShowThumbnailsOnNavigation /t REG_DWORD /d 1”