<feed xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns="http://www.w3.org/2005/Atom" xml:lang="en-US">
    <title>HanSolo</title>
    <link rel="self" type="application/xml" href="http://geekswithblogs.net/martinw/Atom.aspx" />
    <subtitle type="html">code monkey</subtitle>
    <id>http://geekswithblogs.net/martinw/Default.aspx</id>
    <author>
        <name>HanSolo</name>
        <uri>http://geekswithblogs.net/martinw/Default.aspx</uri>
    </author>
    <generator uri="http://subtextproject.com" version="Subtext Version 0.0.0.0">Subtext</generator>
    <updated>2012-04-25T08:39:19Z</updated>
    <entry>
        <title>Handy javascript debugging tip</title>
        <link rel="self" type="text/html" href="http://geekswithblogs.net/martinw/archive/2012/04/25/handy-javascript-debugging-tip.aspx" />
        <id>http://geekswithblogs.net/martinw/archive/2012/04/25/handy-javascript-debugging-tip.aspx</id>
        <published>2012-04-25T08:38:09-12:00:00</published>
        <updated>2012-04-25T08:39:19Z</updated>
        <content type="html">&lt;p&gt;In the project that I am working on, we have many forms that are loaded asynchronously via ajax. Some of these forms contain embedded javacript within the html. Sometimes it can be difficult to debug these scripts. One useful tip that I’ve learned is that you can add “debugger;” to the script where you want the browser to break. You are essentially setting a break point in the code itself by using the debugger statement. Whether you are using web inspector in chrome or firebug in firefox, this should tell the browser to break on that line of code.  This will allow you to step through the code which has helped me immensely in debugging issues in dynamically loaded javascript scripts.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/0bwt76sk(v=vs.94).aspx"&gt;&lt;font color="#0066cc"&gt;http://msdn.microsoft.com/en-us/library/0bwt76sk(v=vs.94).aspx&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://geekswithblogs.net/martinw/aggbug/149426.aspx" width="1" height="1" /&gt;</content>
        <wfw:comment>http://geekswithblogs.net/martinw/comments/149426.aspx</wfw:comment>
        <slash:comments>1</slash:comments>
        <wfw:commentRss>http://geekswithblogs.net/martinw/comments/commentRss/149426.aspx</wfw:commentRss>
        <trackback:ping>http://geekswithblogs.net/martinw/services/trackbacks/149426.aspx</trackback:ping>
    </entry>
    <entry>
        <title>Open and close quotes</title>
        <link rel="self" type="text/html" href="http://geekswithblogs.net/martinw/archive/2012/04/13/open-and-close-quotes.aspx" />
        <id>http://geekswithblogs.net/martinw/archive/2012/04/13/open-and-close-quotes.aspx</id>
        <published>2012-04-13T07:20:06-12:00:00</published>
        <updated>2012-04-13T07:20:06Z</updated>
        <content type="html">&lt;p&gt;Was troubleshooting issues today where our open and close quotes weren’t showing up correctly and found that it was because we were using the wrong character codes. We were using &amp;amp;#147; but should have used &amp;amp;#8220; Something to keep in mind for future reference.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.dwheeler.com/essays/quotes-in-html.html"&gt;&lt;font color="#0066cc"&gt;http://www.dwheeler.com/essays/quotes-in-html.html&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://geekswithblogs.net/martinw/aggbug/149309.aspx" width="1" height="1" /&gt;</content>
        <wfw:comment>http://geekswithblogs.net/martinw/comments/149309.aspx</wfw:comment>
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://geekswithblogs.net/martinw/comments/commentRss/149309.aspx</wfw:commentRss>
        <trackback:ping>http://geekswithblogs.net/martinw/services/trackbacks/149309.aspx</trackback:ping>
    </entry>
    <entry>
        <title>CKEditor and Javascript validation</title>
        <link rel="self" type="text/html" href="http://geekswithblogs.net/martinw/archive/2012/03/08/ckeditor-and-javascript-validation.aspx" />
        <id>http://geekswithblogs.net/martinw/archive/2012/03/08/ckeditor-and-javascript-validation.aspx</id>
        <published>2012-03-08T06:14:11-12:00:00</published>
        <updated>2012-03-08T06:17:34Z</updated>
        <content type="html">&lt;p&gt;I have been working with CKEditor recently and ran into an issue where I noticed some strange random behavior with regards to validation. I noticed that sometimes the validation would pass or fail unexpectedly. It turns out that it was due to the fact that the CKEditor instance creates a separate element for user input and hides the original text area which the validation code validates.  Since CKEditor doesn’t push the changes out to the text area until the control loses focus, if you click on the form submit button, the text area may or may not have been updated, so as a result, the validation may pass or fail unexpectedly. &lt;/p&gt;  &lt;p&gt;The solution that I came up with was to add the following code to the form submit button before the form validation code. This ensures that the CKEditor content and the text area are always in sync when the validation runs. &lt;/p&gt; &lt;font color="#171717" size="2" face="Consolas"&gt;&lt;font color="#171717" size="2" face="Consolas"&gt;&lt;font color="#171717" size="2" face="Consolas"&gt;            &lt;/font&gt;&lt;/font&gt;&lt;font color="#006400" size="2" face="Consolas"&gt;&lt;font color="#006400" size="2" face="Consolas"&gt;&lt;font color="#006400" size="2" face="Consolas"&gt;//force each ckeditor instance on page to update their related text area elements so that we can perform validation on those elements&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#171717" size="2" face="Consolas"&gt;&lt;font color="#171717" size="2" face="Consolas"&gt;&lt;font color="#171717" size="2" face="Consolas"&gt; &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;div&gt;&lt;font color="#171717" size="2" face="Consolas"&gt;&lt;font color="#0000ff" size="2" face="Consolas"&gt;&lt;font color="#0000ff" size="2" face="Consolas"&gt;&lt;font color="#0000ff" size="2" face="Consolas"&gt;&lt;br /&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/div&gt;&lt;div&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;if (CKEDITOR != undefined) {&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;    for (var instance in CKEDITOR.instances)&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;        CKEDITOR.instances[instance].updateElement();&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;}&lt;/div&gt;&lt;/font&gt;&lt;font color="#171717" size="2" face="Consolas"&gt;&lt;font color="#171717" size="2" face="Consolas"&gt;&lt;font color="#171717" size="2" face="Consolas"&gt;     &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;  &lt;p&gt;Hopes this helps someone that got stumped like I did. &lt;img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://geekswithblogs.net/images/geekswithblogs_net/martinw/Windows-Live-Writer/CKEditor-and-Javascript-validation_9AE3/wlEmoticon-smile_2.png" /&gt;&lt;/p&gt;&lt;/div&gt;&lt;img src="http://geekswithblogs.net/martinw/aggbug/148940.aspx" width="1" height="1" /&gt;</content>
        <wfw:comment>http://geekswithblogs.net/martinw/comments/148940.aspx</wfw:comment>
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://geekswithblogs.net/martinw/comments/commentRss/148940.aspx</wfw:commentRss>
        <trackback:ping>http://geekswithblogs.net/martinw/services/trackbacks/148940.aspx</trackback:ping>
    </entry>
    <entry>
        <title>Calling a .NET C# class from XSLT</title>
        <link rel="self" type="text/html" href="http://geekswithblogs.net/martinw/archive/2010/04/13/calling-a-class-from-xslt.aspx" />
        <id>http://geekswithblogs.net/martinw/archive/2010/04/13/calling-a-class-from-xslt.aspx</id>
        <published>2010-04-13T11:41:44-12:00:00</published>
        <updated>2010-04-13T11:45:06Z</updated>
        <content type="html">&lt;p&gt;If you've ever worked with XSLT, you'd know that it's pretty limited when it comes to its programming capabilities. Try writing a for loop in XSLT and you'd know what I mean. XSLT is not designed to be a programming language so you should never put too much programming logic in your XSLT. That code can be a pain to write and maintain and so it should be avoided at all costs. Keep your xslt simple and put any complex logic that your xslt transformation requires in a class.&lt;/p&gt;
&lt;p&gt;Here is how you can create a helper class and call that from your xslt. For example, this is my helper class:&lt;/p&gt;
&lt;p&gt;&lt;!--
{\rtf1\ansi\ansicpg\lang1024\noproof1252\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green0\blue0;\red255\green255\blue255;\red0\green0\blue255;\red43\green145\blue175;}??\fs20  \cf3 public\cf0  \cf3 class\cf0  \cf4 XsltHelper\par ??\cf0     \{\par ??        \cf3 public\cf0  \cf3 string\cf0  GetStringHash(\cf3 string\cf0  originalString)\par ??        \{\par ??            \cf3 return\cf0  originalString.GetHashCode().ToString();\par ??        \}\par ??    \}}
--&gt;&lt;/p&gt;
&lt;div style="font-family: Courier New; font-size: 10pt; color: black; background: none repeat scroll 0% 0% white;"&gt;
&lt;pre style="margin: 0px;"&gt;
 &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;class&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;XsltHelper&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;
    {&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;
        &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;string&lt;/span&gt; GetStringHash(&lt;span style="color: blue;"&gt;string&lt;/span&gt; originalString)&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;
        {&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;
            &lt;span style="color: blue;"&gt;return&lt;/span&gt; originalString.GetHashCode().ToString();&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;
        }&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;
    }&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;And this is my xslt file(notice the namespace declaration that references the helper class):&lt;/p&gt;
&lt;p&gt;&lt;!--
{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green0\blue255;\red255\green255\blue255;\red163\green21\blue21;\red255\green0\blue0;\red0\green0\blue0;\red43\green145\blue175;}??\fs20 \cf1 &amp;lt;?\cf3 xml\cf1  \cf4 version\cf1 =\cf0 "\cf1 1.0\cf0 "\cf1  \cf4 encoding\cf1 =\cf0 "\cf1 UTF-8\cf0 "\cf1  ?&amp;gt;\par ??&amp;lt;\cf6 xsl:stylesheet\cf1   \cf4 xmlns:xsl\cf1 =\cf0 "\cf1 http://www.w3.org/1999/XSL/Transform\cf0 "\cf1  \cf4 version\cf1 =\cf0 "\cf1 1.0\cf0 "\cf1  \cf4 xmlns:ext\cf1 =\cf0 "\cf1 http://MyNamespace\cf0 "\cf1 &amp;gt;\par ??\tab &amp;lt;\cf6 xsl:output\cf1  \cf4 method\cf1 =\cf0 "\cf1 text\cf0 "\cf1  \cf4 indent\cf1 =\cf0 "\cf1 yes\cf0 "\cf1  \cf4 omit-xml-declaration\cf1 =\cf0 "\cf1 yes\cf0 "\cf1 /&amp;gt;\par ??\tab &amp;lt;\cf6 xsl:template\cf1   \cf4 match\cf1 =\cf0 "\cf1 /\cf0 "\cf1 &amp;gt;\cf0 The hash code of "\cf1 &amp;lt;\cf6 xsl:value-of\cf1  \cf4 select\cf1 =\cf0 "\cf1 stringList/string1\cf0 "\cf1  /&amp;gt;\cf0 " is "\cf1 &amp;lt;\cf6 xsl:value-of\cf1  \cf4 select\cf1 =\cf0 "\cf1 ext:GetStringHash(stringList/string1)\cf0 "\cf1  /&amp;gt;\cf0 ".\par ??\cf1 \tab &amp;lt;/\cf6 xsl:template\cf1 &amp;gt;\par ??&amp;lt;/\cf6 xsl:stylesheet\cf1 &amp;gt;}
--&gt;&lt;/p&gt;
&lt;div style="font-family: Courier New; font-size: 10pt; color: black; background: none repeat scroll 0% 0% white;"&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;lt;?&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;xml&lt;/span&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;version&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;1.0&lt;/span&gt;"&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;encoding&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;UTF-8&lt;/span&gt;"&lt;span style="color: blue;"&gt; ?&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;xsl:stylesheet&lt;/span&gt;&lt;span style="color: blue;"&gt;  &lt;/span&gt;&lt;span style="color: red;"&gt;xmlns:xsl&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;http://www.w3.org/1999/XSL/Transform&lt;/span&gt;"&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;version&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;1.0&lt;/span&gt;"&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;xmlns:ext&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;http://MyNamespace&lt;/span&gt;"&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;    &amp;lt;&lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;xsl:output&lt;/span&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;method&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;text&lt;/span&gt;"&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;indent&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;yes&lt;/span&gt;"&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;omit-xml-declaration&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;yes&lt;/span&gt;"&lt;span style="color: blue;"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;    &amp;lt;&lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;xsl:template&lt;/span&gt;&lt;span style="color: blue;"&gt;  &lt;/span&gt;&lt;span style="color: red;"&gt;match&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;/&lt;/span&gt;"&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;The hash code of "&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;xsl:value-of&lt;/span&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;select&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;stringList/string1&lt;/span&gt;"&lt;span style="color: blue;"&gt; /&amp;gt;&lt;/span&gt;" is "&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;xsl:value-of&lt;/span&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;select&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;ext:GetStringHash(stringList/string1)&lt;/span&gt;"&lt;span style="color: blue;"&gt; /&amp;gt;&lt;/span&gt;".&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;    &amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;xsl:template&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;xsl:stylesheet&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Here is how you can include the helper class as part of the transformation:&lt;/p&gt;
&lt;p&gt;&lt;!--
{\rtf1\ansi\ansicpg\lang1024\noproof1252\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green0\blue255;\red255\green255\blue255;\red0\green0\blue0;\red163\green21\blue21;\red43\green145\blue175;\red0\green128\blue0;}??\fs20 \cf1 string\cf0  xml = \cf4 "&amp;lt;stringList&amp;gt;&amp;lt;string1&amp;gt;test&amp;lt;/string1&amp;gt;&amp;lt;/stringList&amp;gt;"\cf0 ;\par ??            \cf5 XmlDocument\cf0  xmlDocument = \cf1 new\cf0  \cf5 XmlDocument\cf0 ();\par ??            xmlDocument.LoadXml(xml);\par ??\par ??            \cf5 XslCompiledTransform\cf0  xslCompiledTransform = \cf1 new\cf0  \cf5 XslCompiledTransform\cf0 ();\par ??            xslCompiledTransform.Load(\cf4 "XSLTFile1.xslt"\cf0 );\par ??                        \par ??            \cf5 XsltArgumentList\cf0  xsltArgs = \cf1 new\cf0  \cf5 XsltArgumentList\cf0 ();            \par ??            xsltArgs.AddExtensionObject(\cf4 "http://MyNamespace"\cf0 , \cf5 Activator\cf0 .CreateInstance(\cf1 typeof\cf0 (\cf5 XsltHelper\cf0 )));\par ??            \par ??            \cf1 using\cf0  (\cf5 FileStream\cf0  fileStream = \cf1 new\cf0  \cf5 FileStream\cf0 (\cf4 "TransformResults.txt"\cf0 , \cf5 FileMode\cf0 .OpenOrCreate, \cf5 FileAccess\cf0 .ReadWrite, \cf5 FileShare\cf0 .ReadWrite))\par ??            \{\par ??                \cf6 // transform the xml and output to the output file ...\par ??\cf0                 xslCompiledTransform.Transform(xmlDocument, xsltArgs, fileStream);                \par ??            \}}
--&gt;&lt;/p&gt;
&lt;div style="font-family: Courier New; font-size: 10pt; color: black; background: none repeat scroll 0% 0% white;"&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;string&lt;/span&gt; xml = &lt;span style="color: rgb(163, 21, 21);"&gt;"&amp;lt;stringList&amp;gt;&amp;lt;string1&amp;gt;test&amp;lt;/string1&amp;gt;&amp;lt;/stringList&amp;gt;"&lt;/span&gt;;&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;
            &lt;span style="color: rgb(43, 145, 175);"&gt;XmlDocument&lt;/span&gt; xmlDocument = &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;XmlDocument&lt;/span&gt;();&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;
            xmlDocument.LoadXml(xml);&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;
 &lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;
            &lt;span style="color: rgb(43, 145, 175);"&gt;XslCompiledTransform&lt;/span&gt; xslCompiledTransform = &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;XslCompiledTransform&lt;/span&gt;();&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;
            xslCompiledTransform.Load(&lt;span style="color: rgb(163, 21, 21);"&gt;"XSLTFile1.xslt"&lt;/span&gt;);&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;
 &lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;
            &lt;span style="color: rgb(43, 145, 175);"&gt;XsltArgumentList&lt;/span&gt; xsltArgs = &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;XsltArgumentList&lt;/span&gt;();            &lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;
            xsltArgs.AddExtensionObject(&lt;span style="color: rgb(163, 21, 21);"&gt;"http://MyNamespace"&lt;/span&gt;, &lt;span style="color: rgb(43, 145, 175);"&gt;Activator&lt;/span&gt;.CreateInstance(&lt;span style="color: blue;"&gt;typeof&lt;/span&gt;(&lt;span style="color: rgb(43, 145, 175);"&gt;XsltHelper&lt;/span&gt;)));&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;
 &lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;
            &lt;span style="color: blue;"&gt;using&lt;/span&gt; (&lt;span style="color: rgb(43, 145, 175);"&gt;FileStream&lt;/span&gt; fileStream = &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;FileStream&lt;/span&gt;(&lt;span style="color: rgb(163, 21, 21);"&gt;"TransformResults.txt"&lt;/span&gt;, &lt;span style="color: rgb(43, 145, 175);"&gt;FileMode&lt;/span&gt;.OpenOrCreate, &lt;span style="color: rgb(43, 145, 175);"&gt;FileAccess&lt;/span&gt;.ReadWrite, &lt;span style="color: rgb(43, 145, 175);"&gt;FileShare&lt;/span&gt;.ReadWrite))&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;
            {&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;
                &lt;span style="color: green;"&gt;// transform the xml and output to the output file ...&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;
                xslCompiledTransform.Transform(xmlDocument, xsltArgs, fileStream);                &lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;
            }&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt; &lt;/p&gt;&lt;img src="http://geekswithblogs.net/martinw/aggbug/139243.aspx" width="1" height="1" /&gt;</content>
        <wfw:comment>http://geekswithblogs.net/martinw/comments/139243.aspx</wfw:comment>
        <slash:comments>2</slash:comments>
        <wfw:commentRss>http://geekswithblogs.net/martinw/comments/commentRss/139243.aspx</wfw:commentRss>
        <trackback:ping>http://geekswithblogs.net/martinw/services/trackbacks/139243.aspx</trackback:ping>
    </entry>
    <entry>
        <title>Writing to a file asynchronously</title>
        <link rel="self" type="text/html" href="http://geekswithblogs.net/martinw/archive/2009/10/15/writing-to-a-file-asynchronously.aspx" />
        <id>http://geekswithblogs.net/martinw/archive/2009/10/15/writing-to-a-file-asynchronously.aspx</id>
        <published>2009-10-15T13:48:45-12:00:00</published>
        <updated>2009-10-15T13:48:45Z</updated>
        <content type="html">&lt;div&gt;&lt;font size="2" face="Courier New, monospace"&gt; &lt;font color="#0000ff"&gt;Here is a code snippet for writing to a file asynchronously:&lt;br /&gt;
&lt;br /&gt;
private&lt;/font&gt; &lt;font color="#0000ff"&gt;void&lt;/font&gt; writeFileAsync(&lt;font color="#0000ff"&gt;string&lt;/font&gt; text)&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font size="2" face="Courier New, monospace"&gt;{&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font size="2" face="Courier New, monospace"&gt;      System.Text.&lt;font color="#2b91af"&gt;ASCIIEncoding&lt;/font&gt; encoding = &lt;font color="#0000ff"&gt;new&lt;/font&gt; System.Text.&lt;font color="#2b91af"&gt;ASCIIEncoding&lt;/font&gt;();&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font size="2" face="Courier New, monospace"&gt;      &lt;font color="#0000ff"&gt;byte&lt;/font&gt;[] buffer = encoding.GetBytes(text);&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font size="2" face="Courier New, monospace"&gt;      &lt;font color="#0000ff"&gt;using&lt;/font&gt; (&lt;font color="#2b91af"&gt;FileStream&lt;/font&gt; fs = &lt;font color="#0000ff"&gt;new&lt;/font&gt; &lt;font color="#2b91af"&gt;FileStream&lt;/font&gt;(&lt;font color="#a31515"&gt;"temp.txt"&lt;/font&gt;, &lt;font color="#2b91af"&gt;FileMode&lt;/font&gt;.Append, &lt;font color="#2b91af"&gt;FileAccess&lt;/font&gt;.Write, &lt;font color="#2b91af"&gt;FileShare&lt;/font&gt;.ReadWrite, buffer.Length, &lt;font color="#2b91af"&gt;FileOptions&lt;/font&gt;.Asynchronous))&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font size="2" face="Courier New, monospace"&gt;      {&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font size="2" face="Courier New, monospace"&gt;           &lt;font color="#2b91af"&gt;IAsyncResult&lt;/font&gt; asyncResult = fs.BeginWrite(buffer, 0, buffer.Length, &lt;font color="#0000ff"&gt;new&lt;/font&gt; &lt;font color="#2b91af"&gt;AsyncCallback&lt;/font&gt;(EndWriteCallback), &lt;font color="#0000ff"&gt;new&lt;/font&gt; &lt;font color="#2b91af"&gt;State&lt;/font&gt;());&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font size="2" face="Courier New, monospace"&gt;      }&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font size="2" face="Courier New, monospace"&gt; }&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font size="2" face="Courier New, monospace"&gt;&lt;br /&gt;
&lt;font color="#0000ff"&gt;private&lt;/font&gt; &lt;font color="#0000ff"&gt;void&lt;/font&gt; EndWriteCallback(&lt;font color="#2b91af"&gt;IAsyncResult&lt;/font&gt; result)&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font size="2" face="Courier New, monospace"&gt; {&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font size="2" face="Courier New, monospace"&gt; &lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font size="2" face="Courier New, monospace"&gt; }&lt;/font&gt;&lt;/div&gt;&lt;img src="http://geekswithblogs.net/martinw/aggbug/135491.aspx" width="1" height="1" /&gt;</content>
        <wfw:comment>http://geekswithblogs.net/martinw/comments/135491.aspx</wfw:comment>
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://geekswithblogs.net/martinw/comments/commentRss/135491.aspx</wfw:commentRss>
        <trackback:ping>http://geekswithblogs.net/martinw/services/trackbacks/135491.aspx</trackback:ping>
    </entry>
    <entry>
        <title>DataGridView upper case textbox column</title>
        <link rel="self" type="text/html" href="http://geekswithblogs.net/martinw/archive/2009/09/15/datagridview-upper-case-textbox-column.aspx" />
        <id>http://geekswithblogs.net/martinw/archive/2009/09/15/datagridview-upper-case-textbox-column.aspx</id>
        <published>2009-09-15T00:30:37-12:00:00</published>
        <updated>2009-09-14T17:40:41Z</updated>
        <content type="html">It's a shame that the DataGridViewTextBoxColumn class doesn't allow you to set the casing so that you can restrict user input to all upper or lower case letters.&lt;br /&gt;
&lt;br /&gt;
Fortunately, it's actually pretty easy to create a custom column class to do just that. &lt;br /&gt;
&lt;!--
{\rtf1\ansi\ansicpg\lang1024\noproof1252\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green0\blue255;\red255\green255\blue255;\red0\green0\blue0;\red43\green145\blue175;}??\fs20 \cf1 public\cf0  \cf1 class\cf0  \cf4 DataGridViewUpperCaseTextBoxColumn\cf0  : \cf4 DataGridViewTextBoxColumn\par ??\cf0 \{\par ??    \cf1 public\cf0  DataGridViewUpperCaseTextBoxColumn()\par ??        : \cf1 base\cf0 ()\par ??    \{\par ??        CellTemplate = \cf1 new\cf0  \cf4 DataGridViewUpperCaseTextBoxCell\cf0 ();\par ??    \}\par ??\}\par ??\par ??\cf1 public\cf0  \cf1 class\cf0  \cf4 DataGridViewUpperCaseTextBoxCell\cf0  : \cf4 DataGridViewTextBoxCell\par ??\cf0 \{\par ??    \cf1 public\cf0  DataGridViewUpperCaseTextBoxCell()\par ??        : \cf1 base\cf0 ()\par ??    \{\par ??    \}\par ??\par ??    \cf1 public\cf0  \cf1 override\cf0  \cf4 Type\cf0  EditType\par ??    \{\par ??        \cf1 get\par ??\cf0         \{\par ??            \cf1 return\cf0  \cf1 typeof\cf0 (\cf4 DataGridViewUpperCaseTextBoxEditingControl\cf0 );\par ??        \}\par ??    \}\par ??\}\par ??\par ??\cf1 public\cf0  \cf1 class\cf0  \cf4 DataGridViewUpperCaseTextBoxEditingControl\cf0  : \cf4 DataGridViewTextBoxEditingControl\par ??\cf0 \{\par ??    \cf1 public\cf0  DataGridViewUpperCaseTextBoxEditingControl()\par ??        : \cf1 base\cf0 ()\par ??    \{\par ??        \cf1 this\cf0 .CharacterCasing = \cf4 CharacterCasing\cf0 .Upper;\par ??    \}\par ??\}}
--&gt;
&lt;div style="background: white none repeat scroll 0% 0%; font-family: Courier New; font-size: 10pt; color: black; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;class&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;DataGridViewUpperCaseTextBoxColumn&lt;/span&gt; : &lt;span style="color: rgb(43, 145, 175);"&gt;DataGridViewTextBoxColumn&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;{&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;    &lt;span style="color: blue;"&gt;public&lt;/span&gt; DataGridViewUpperCaseTextBoxColumn()&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;        : &lt;span style="color: blue;"&gt;base&lt;/span&gt;()&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;    {&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;        CellTemplate = &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;DataGridViewUpperCaseTextBoxCell&lt;/span&gt;();&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;    }&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;}&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt; &lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;class&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;DataGridViewUpperCaseTextBoxCell&lt;/span&gt; : &lt;span style="color: rgb(43, 145, 175);"&gt;DataGridViewTextBoxCell&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;{&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;    &lt;span style="color: blue;"&gt;public&lt;/span&gt; DataGridViewUpperCaseTextBoxCell()&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;        : &lt;span style="color: blue;"&gt;base&lt;/span&gt;()&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;    {&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;    }&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt; &lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;    &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;override&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;Type&lt;/span&gt; EditType&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;    {&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;        &lt;span style="color: blue;"&gt;get&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;        {&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;            &lt;span style="color: blue;"&gt;return&lt;/span&gt; &lt;span style="color: blue;"&gt;typeof&lt;/span&gt;(&lt;span style="color: rgb(43, 145, 175);"&gt;DataGridViewUpperCaseTextBoxEditingControl&lt;/span&gt;);&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;        }&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;    }&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;}&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt; &lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;class&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;DataGridViewUpperCaseTextBoxEditingControl&lt;/span&gt; : &lt;span style="color: rgb(43, 145, 175);"&gt;DataGridViewTextBoxEditingControl&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;{&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;    &lt;span style="color: blue;"&gt;public&lt;/span&gt; DataGridViewUpperCaseTextBoxEditingControl()&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;        : &lt;span style="color: blue;"&gt;base&lt;/span&gt;()&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;    {&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;        &lt;span style="color: blue;"&gt;this&lt;/span&gt;.CharacterCasing = &lt;span style="color: rgb(43, 145, 175);"&gt;CharacterCasing&lt;/span&gt;.Upper;&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;    }&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
Sweet fancy moses:)&lt;img src="http://geekswithblogs.net/martinw/aggbug/134822.aspx" width="1" height="1" /&gt;</content>
        <wfw:comment>http://geekswithblogs.net/martinw/comments/134822.aspx</wfw:comment>
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://geekswithblogs.net/martinw/comments/commentRss/134822.aspx</wfw:commentRss>
        <trackback:ping>http://geekswithblogs.net/martinw/services/trackbacks/134822.aspx</trackback:ping>
    </entry>
    <entry>
        <title>Scrollable PictureBox control</title>
        <link rel="self" type="text/html" href="http://geekswithblogs.net/martinw/archive/2009/06/21/scrollable-picturebox-control.aspx" />
        <id>http://geekswithblogs.net/martinw/archive/2009/06/21/scrollable-picturebox-control.aspx</id>
        <published>2009-06-21T22:14:34-12:00:00</published>
        <updated>2009-06-21T22:14:57Z</updated>
        <content type="html">The PictureBox control in .NET does not have scroll bars, however, it is actually really easy to create a PictureBox control with scroll bars enabled. All you have to do is to drop a panel control onto a form, and set the AutoScroll property to true.&lt;br /&gt;
&lt;br /&gt;
&lt;!--
{\rtf1\ansi\ansicpg\lang1024\noproof1252\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green0\blue255;\red255\green255\blue255;\red0\green0\blue0;}??\fs20 \cf1 this\cf0 .panel1.AutoScroll = \cf1 true\cf0 ;}
--&gt;
&lt;div style="background: white none repeat scroll 0% 0%; font-family: Courier New; font-size: 10pt; color: black; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;this&lt;/span&gt;.panel1.AutoScroll = &lt;span style="color: blue;"&gt;true&lt;/span&gt;;&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
And drop a PictureBox control inside the panel and set the SizeMode to AutoSize. &lt;br /&gt;
&lt;br /&gt;
&lt;!--
{\rtf1\ansi\ansicpg\lang1024\noproof1252\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green0\blue255;\red255\green255\blue255;\red0\green0\blue0;\red43\green145\blue175;}??\fs20 \cf1 this\cf0 .pictureBox1.SizeMode = System.Windows.Forms.\cf4 PictureBoxSizeMode\cf0 .AutoSize;}
--&gt;
&lt;div style="background: white none repeat scroll 0% 0%; font-family: Courier New; font-size: 10pt; color: black; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;this&lt;/span&gt;.pictureBox1.SizeMode = System.Windows.Forms.&lt;span style="color: rgb(43, 145, 175);"&gt;PictureBoxSizeMode&lt;/span&gt;.AutoSize;&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
That's it.&lt;img src="http://geekswithblogs.net/martinw/aggbug/132970.aspx" width="1" height="1" /&gt;</content>
        <wfw:comment>http://geekswithblogs.net/martinw/comments/132970.aspx</wfw:comment>
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://geekswithblogs.net/martinw/comments/commentRss/132970.aspx</wfw:commentRss>
        <trackback:ping>http://geekswithblogs.net/martinw/services/trackbacks/132970.aspx</trackback:ping>
    </entry>
    <entry>
        <title>Starting a background thread using the Threadpool</title>
        <link rel="self" type="text/html" href="http://geekswithblogs.net/martinw/archive/2009/05/09/starting-a-background-thread-using-the-threadpool.aspx" />
        <id>http://geekswithblogs.net/martinw/archive/2009/05/09/starting-a-background-thread-using-the-threadpool.aspx</id>
        <published>2009-05-09T13:42:00-12:00:00</published>
        <updated>2009-05-09T13:42:00Z</updated>
        <content type="html">Here is a quick and easy way of starting a background process using the Threadpool by way of an inline delegate.&lt;br /&gt;&lt;br /&gt;

&lt;!--
{\rtf1\ansi\ansicpg\lang1024\noproof1252\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red43\green145\blue175;\red255\green255\blue255;\red0\green0\blue0;\red0\green0\blue255;}??\fs20 \cf1 ThreadPool\cf0 .QueueUserWorkItem(\cf4 new\cf0  \cf1 WaitCallback\cf0 (\par ??\cf4 delegate\cf0 (\cf4 object\cf0  stateInfo)\par ??\{\par ??    saveToDB();\par ??\}));         \par ??}
--&gt;
&lt;div style="font-family: Courier New; font-size: 10pt; color: black; background: white;"&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;ThreadPool&lt;/span&gt;.QueueUserWorkItem(&lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;WaitCallback&lt;/span&gt;(&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;delegate&lt;/span&gt;(&lt;span style="color: blue;"&gt;object&lt;/span&gt; stateInfo)&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;{&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;    saveToDB();&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;}));         &lt;/pre&gt;
&lt;/div&gt;
&lt;img src="http://geekswithblogs.net/martinw/aggbug/131927.aspx" width="1" height="1" /&gt;</content>
        <wfw:comment>http://geekswithblogs.net/martinw/comments/131927.aspx</wfw:comment>
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://geekswithblogs.net/martinw/comments/commentRss/131927.aspx</wfw:commentRss>
        <trackback:ping>http://geekswithblogs.net/martinw/services/trackbacks/131927.aspx</trackback:ping>
    </entry>
    <entry>
        <title>Time enjoyed wasting is not wasted time</title>
        <link rel="self" type="text/html" href="http://geekswithblogs.net/martinw/archive/2009/04/29/time-enjoyed-wasting-is-not-wasted-time.aspx" />
        <id>http://geekswithblogs.net/martinw/archive/2009/04/29/time-enjoyed-wasting-is-not-wasted-time.aspx</id>
        <published>2009-04-29T21:18:54-12:00:00</published>
        <updated>2009-04-29T21:18:54Z</updated>
        <content type="html">&lt;embed src="http://tiq.travelpod.com/bin/flash/container.swf" quality="high" bgcolor="#000000" width="625" height="500" name="TravelerIQ" align="middle" type="application/x-shockwave-flash" wmode="opaque" pluginspage="http://www.macromedia.com/go/getflashplayer" allowscriptaccess="always" flashvars="gamexml=http://tiq.travelpod.com/cgi-bin/witw?SessionID=00-traveleriq-game1&amp;amp;gameswf=http://tiq.travelpod.com/bin/flash/witw-00.swf"&gt;&lt;/embed&gt;&lt;img src="http://geekswithblogs.net/martinw/aggbug/131606.aspx" width="1" height="1" /&gt;</content>
        <wfw:comment>http://geekswithblogs.net/martinw/comments/131606.aspx</wfw:comment>
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://geekswithblogs.net/martinw/comments/commentRss/131606.aspx</wfw:commentRss>
        <trackback:ping>http://geekswithblogs.net/martinw/services/trackbacks/131606.aspx</trackback:ping>
    </entry>
    <entry>
        <title>Expect: 100-continue Header Problem</title>
        <link rel="self" type="text/html" href="http://geekswithblogs.net/martinw/archive/2009/04/28/expect-100-continue-header-problem.aspx" />
        <id>http://geekswithblogs.net/martinw/archive/2009/04/28/expect-100-continue-header-problem.aspx</id>
        <published>2009-04-28T23:13:56-12:00:00</published>
        <updated>2009-04-28T23:17:28Z</updated>
        <content type="html">Here is a way for you to disable the &lt;strong&gt;&lt;span style="font-weight: normal;"&gt;Expect: 100-continue Header:&lt;br /&gt;
&lt;br /&gt;
&lt;div style="font-family: Courier New; font-size: 10pt; color: black; background: white;"&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;string&lt;/span&gt; url = &lt;span style="color: #a31515;"&gt;"http://www.myurl.com"&lt;/span&gt;;&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt; &lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;ServicePoint&lt;/span&gt; sp = &lt;span style="color: #2b91af;"&gt;ServicePointManager&lt;/span&gt;.FindServicePoint(&lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;Uri&lt;/span&gt;(url));&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;sp.Expect100Continue = &lt;span style="color: blue;"&gt;false&lt;/span&gt;;&lt;/pre&gt;
&lt;/div&gt;

&lt;br /&gt;
I was getting a 500 http error when I tried to send a post to a Java web service through .Net using HttpWebRequest. Turning off this header did the trick. This will work even if you are using the WebClient class, which goes through HttpWebRequest under the covers. Hope this helps someone, this is a doozy of a problem to debug.&lt;br /&gt;
&lt;/span&gt;&lt;/strong&gt;&lt;img src="http://geekswithblogs.net/martinw/aggbug/131560.aspx" width="1" height="1" /&gt;</content>
        <wfw:comment>http://geekswithblogs.net/martinw/comments/131560.aspx</wfw:comment>
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://geekswithblogs.net/martinw/comments/commentRss/131560.aspx</wfw:commentRss>
        <trackback:ping>http://geekswithblogs.net/martinw/services/trackbacks/131560.aspx</trackback:ping>
    </entry>
</feed>
