The remote certificate is invalid according to the validation procedure for FTP

I was testing a C# FTP application of mine and got this lovely gem of an error when connecting using SSL. I had a self signed certificate in the trusted store, but the FTP library kept screaming that the certificate was invalid.

Well, I found a great workaround for the time being. It should only be used by configuration or conditional compiling though.

Disable Certificate Chain Checking

ServicePointManager.ServerCertificateValidationCallback = delegate(object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return true; };

Using the code above, your certificate checks will always be considered good. The channel will still be SSL protected, you just won’t be looking for man in the middle attacks nor identity mismatches. Something you don’t care about in development, just production.

Happy Coding!

How to get command line args in WPF?

Are you looking how to get the command line arguments in WPF?

It is actually really easy. Simple call Environment.GetCommandLineArgs()

You will be returned a string array (string[]). Remember, the first value is that of the exe being called. i.e your app.


[csharp] Environment.GetCommandLineArgs() [/csharp]

Happy Coding!

How to change the casing of the Visual Studio 2012 Menu


Well, looks like the developer who implemented the shouting case for VS 2012 put in a backdoor. I’ll be he thought it was a stupid decision, so he put in an opt-out. Clever I think.

MSDN put up a nice little description of how to disable it. Here is the key thought for ease.

Yes, you have to add the key yourself.

Open the registry editor and go to HKEY_CURRENT_USERSoftwareMicrosoftVisualStudio11.0General


SuppressUppercaseConversion REG_DWORD value 1



.NET 4.5 in-place upgrade might confuse you and your users

I learned something new today, something I strive to do everyday. I learned that the new .NET 4.5 Framework doesn’t just install side by side with 4.0 but it actually “upgrades” it for you. This doesn’t sound terrible, until you realize that if you are developing an application for 4.0 (many of need to as we support XP clients, which 4.5 won’t run on).

Why the issue, well one is that you run you application and you may not get the quirks you would on a machine with just 4.0. You get the bug fixes that were done for 4.5. Why is this bad? Well, you can’t reproduce the issues your customers face, and worse you won’t see them in development. Hence, you first learn about the issue after it hits your customers. No bueno!.

The issue I am facing is more insidious. I use reflections to reach inside the bowels of the framework to do things that they won’t expose to me publicly. Sealed classes, private initializers, etc. Well, they can rename these things since they aren’t public. You see where I am going. In 4.5, my method isn’t there anymore.

So, user installs 4.5, boom goes the app. Yeah, could have happened with any bug fix, sp, or update. I just didn’t expect a new framework edition to crumble the empire.

Well, just watch out and test your apps on both 4.0 and 4.5 systems. Even if, especially if, you are writing targeted 4.0 applications.

Happy Coding!

More details I read about at Hanselman’s blog.

How to handle keypress in WPF using MVVM?

Did you want to capture the Enter key on a textbox, or the F3 key for find again in your WPF Application when you are using MVVM?

I was using custom behaviors for a while until I realized I was overcomplicating things far too much.

You can wire up commands right to keys very easily.

Here is a sample. Same concept for any framework control.

[sourcecode language=”csharp”]
<KeyBinding Command="{Binding FindNextCommand}" Key="F3"/>

If you had a textbox, just set the TextBox.InputBindings and the key to Enter. Happy Coding!

How to Convert a PDF to Black and White in Adobe Acrobat Pro

You sometimes want your PDF to be in GreyScale or black and white as it were. It can make it look more uniform, or if you had a flaky scanned document and the color looks off.


Anyway, it is quite easy to convert a document to Black and White in Acrobat Pro 9.

1) Open document. Duh.

2) Click Window –> Preproduction –> PreFlight

3) CLick the down arrow under PDF Fixups.

4) CLick the Convert to grayscal row/option.

5) CLick Analyze and Fix(bottom right hand corner).

6) Pick new filename. Voila! You are done.


Happy coding…err..converting?