Arnout's Eclectica

But I digress…

Making HttpWebRequest work while having Fiddler decrypt SSL

Just a quick reminder to myself, so that I can forget about it...

Fiddler can act as a man-in-the-middle and decrypt SSL traffic, but then System.Net.Security rightfully complains about an invalid remote certificate ("The remote certificate is invalid according to the validation procedure."). This results in a System.Net.WebException "The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.".

To prevent this from happening:

ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };

Just be sure to not include this in production code :-)

Copying message box text to the clipboard

9 May 2006 22:22 — Tips & Tricks,Windows

Screen dump of standard Windows message box containing the text "Did you know that CTRL-C copies this text to the clipboard?"

(This post triggered by receiving a lovely screen dump of a message box. A message box covering almost the complete screen, and containing lots of serialized XML. XML containing lots of entitified HTML...)

CMD does not support UNC paths as current directories. Use PUSHD instead.

25 April 2006 20:41 — Tips & Tricks,Windows

CMD.exe does not allow changing the current directory to a UNC path. If you try, it complains that "CMD does not support UNC paths as current directories.".

PUSHD to the rescue:

C:\\> pushd \\\\serendipity\\D$

   Do something here with the files on Z:

Z:\\> popd
C:\\> _

PUSHD temporarily maps a drive letter to the specified UNC share (starting from Z: on down until it finds one that's available). Until you call POPD, you can access the share via that drive letter (also from other DOS boxes and Windows Explorer).

Sure beats mapping and unmapping shares all the time, but keep in mind that the PUSHD trick only works if you don't need to specify credentials to access the share.

Copyright © 2006-2009 Arnout Grootveld — Powered by WordPress — Hosted at pair Networks