<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>my code trip &#187; .Net Framework</title>
	<atom:link href="http://mycodetrip.com/tag/ms-net-dotnet-framework/feed/" rel="self" type="application/rss+xml" />
	<link>http://mycodetrip.com</link>
	<description>stories from the information technology highway</description>
	<lastBuildDate>Mon, 29 Nov 2010 19:58:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
		<item>
		<title>Recursively Copy Files During Build Using the  Task in MSBuild</title>
		<link>http://mycodetrip.com/2009/01/05/recursively-copy-files-during-build-using-the-task-in-msbuild_211/</link>
		<comments>http://mycodetrip.com/2009/01/05/recursively-copy-files-during-build-using-the-task-in-msbuild_211/#comments</comments>
		<pubDate>Mon, 05 Jan 2009 16:47:23 +0000</pubDate>
		<dc:creator>Shiva</dc:creator>
				<category><![CDATA[Tips / HowTos]]></category>
		<category><![CDATA[.Net Framework]]></category>
		<category><![CDATA[How To]]></category>

		<guid isPermaLink="false">http://mycodetrip.com/?p=211</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[]]></content:encoded>
			<wfw:commentRss>http://mycodetrip.com/2009/01/05/recursively-copy-files-during-build-using-the-task-in-msbuild_211/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why Microsoft Should Introduce Compiler Extensibility But May Not</title>
		<link>http://mycodetrip.com/2008/10/31/why-microsoft-should-introduce-compiler-extensibility-but-may-not_202/</link>
		<comments>http://mycodetrip.com/2008/10/31/why-microsoft-should-introduce-compiler-extensibility-but-may-not_202/#comments</comments>
		<pubDate>Fri, 31 Oct 2008 17:57:40 +0000</pubDate>
		<dc:creator>Shiva</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[.Net Framework]]></category>

		<guid isPermaLink="false">http://mycodetrip.com/?p=202</guid>
		<description><![CDATA[Tore Vestues discusses the possible benefits of introducing compiler extensibility that would allow developers to get into the .Net code ]]></description>
			<content:encoded><![CDATA[<p><strong>Tore Vestues</strong> discusses the possible benefits of introducing compiler extensibility that would allow developers to get into the .Net code compliation process and modify code before generating the .Net assembly. He also cautions us not to get too excited because it seems that <strong>Anders Hejlsberg</strong> (C# creator) mentioned in a <strong>PDC 2008 session</strong> that <strong>compiler extensibility will <em>never ever be available </em>in C#</strong>.</p>
]]></content:encoded>
			<wfw:commentRss>http://mycodetrip.com/2008/10/31/why-microsoft-should-introduce-compiler-extensibility-but-may-not_202/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fix For Error: The Requested FTP Command Is Not Supported When Using HTTP Proxy</title>
		<link>http://mycodetrip.com/2008/10/29/fix-for-error-the-requested-ftp-command-is-not-supported-when-using-http-proxy_118/</link>
		<comments>http://mycodetrip.com/2008/10/29/fix-for-error-the-requested-ftp-command-is-not-supported-when-using-http-proxy_118/#comments</comments>
		<pubDate>Wed, 29 Oct 2008 17:30:09 +0000</pubDate>
		<dc:creator>Shiva Manjunath</dc:creator>
				<category><![CDATA[Tips / HowTos]]></category>
		<category><![CDATA[.Net Framework]]></category>
		<category><![CDATA[Bugs And Fixes]]></category>

		<guid isPermaLink="false">http://mycodetrip.com/?p=118</guid>
		<description><![CDATA[Fix for the Error "System.InvalidOperationException: The requested FTP command is not supported when using HTTP proxy."]]></description>
			<content:encoded><![CDATA[<p><strong>Problem:</strong> I created a <strong>SQL Server CLR stored procedure</strong> today from a <strong>C# utility dll</strong> to upload files to an FTP server. When I tried to execute the CLR stored procedure, I got the following error.<br />
<code>Msg 6522, Level 16, State 1, Procedure usp_FtpUploadFile, Line 0<br />
A .NET Framework error occurred during execution of user-defined routine or aggregate "usp_mct_FtpUploadFile":<br />
System.InvalidOperationException: The requested FTP command is not supported when using HTTP proxy.<br />
System.InvalidOperationException:<br />
at System.Net.FtpWebRequest.GetHttpWebRequest()<br />
at System.Net.FtpWebRequest.GetRequestStream()<br />
at mycodetrip.com.Utils.FtpUtils.UploadFile(SqlString ftpServerAndFolder, SqlString uploadFileName, SqlString ftpUser, SqlString ftpPassword, SqlString localSourceFileFolder)<br />
</code><br />
What was surprising was that my <strong>NUnit test in C#</strong> that called my utility method &#8220;<strong>UploadFile</strong>&#8221; worked fine. However, when I created a SQL Server CLR stored procedure from the same utility method&#8217;s assembly and tried to run in from within SQL Server I got this error.</p>
<p><strong>Solution:</strong> After a bit of investigation, I found that the error was happening because the method call from SQL Server was attempting to use the <strong>HttpProxy </strong>on the Server machine. If the <strong>proxy </strong>is not set to <strong>null</strong> <em>explicitly </em>in your code, then you will get this error.</p>
<p>So to fix it, set the Proxy of the request object to null as follows (see line # 3) .<br />
<strong>C# Version</strong></p>
<pre class="brush: csharp">
FtpWebRequest request =
(FtpWebRequest)WebRequest.Create((string)ftpServerAndFolder + &quot;/&quot; + (string)uploadFileName);
// set proxy to null to avoid the System.InvalidOperationException: The requested FTP command is not supported when using HTTP proxy.
request.Proxy = null;
request.Method = WebRequestMethods.Ftp.UploadFile;
request.Credentials = new NetworkCredential((string)ftpUser, (string)ftpPassword);
</pre>
<p><strong>VB.Net Version</strong></p>
<pre class="brush: vb">
FtpWebRequest request =
CType(WebRequest.Create(CType(ftpServerAndFolder + &quot;/&quot; + CType(uploadFileName, string, String))), FtpWebRequest)
&#039; set proxy to null to avoid the System.InvalidOperationException: The requested FTP command is not supported when using HTTP proxy.
request.Proxy = Nothing
request.Method = WebRequestMethods.Ftp.UploadFile
request.Credentials = New NetworkCredential(CType(ftpUser, CType(ftpPassword, string, String)))
</pre>
]]></content:encoded>
			<wfw:commentRss>http://mycodetrip.com/2008/10/29/fix-for-error-the-requested-ftp-command-is-not-supported-when-using-http-proxy_118/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Where is ildasm.exe (MSIL Disassembler) located ?</title>
		<link>http://mycodetrip.com/2008/09/23/where-is-ildasm-exe-mil-disassembler-located-2-35_95/</link>
		<comments>http://mycodetrip.com/2008/09/23/where-is-ildasm-exe-mil-disassembler-located-2-35_95/#comments</comments>
		<pubDate>Tue, 23 Sep 2008 21:58:18 +0000</pubDate>
		<dc:creator>Shiva Manjunath</dc:creator>
				<category><![CDATA[Tips / HowTos]]></category>
		<category><![CDATA[.Net Framework]]></category>

		<guid isPermaLink="false">http://mycodetrip.com/?p=95</guid>
		<description><![CDATA[How to find ildasm.exe on your developer machine. Also includes links to tutorial and ildasm.exe usage documentation.]]></description>
			<content:encoded><![CDATA[<p><strong>ildasm.exe</strong>, the Microsoft .Net Intermediate Language Disassembler, is usually found in your <strong>Visual Studio SDK </strong>folder (which would have been created when you installed Visual Studio on your developer machine).</p>
<p><strong>.Net 3.5</strong> &#8211; The default installation would have placed the ildasm executable in the following folder.</p>
<pre class="brush: html">
C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin
</pre>
<p><strong>.Net 2.0</strong> &#8211; The default installation would have placed the ildasm executable in the following folder</p>
<pre class="brush: html">
C:\Program Files\Microsoft.NET\FrameworkSDK\bin
</pre>
<p>If you open a <strong>Visual Studio <em>version</em> Command Prompt</strong> window and type ildasm, it should work. However, if it doesn&#8217;t or if you are more used to doing stuff in the regular command prompt window, then the best way to save time wasted in searching for this exe everytime is, to first locate it one time by doing a search for &#8220;ildasm.exe&#8221; under your &#8220;Program Files&#8221; folder, and then adding the path to the bin directory where the exe is located in your environment&#8217;s PATH variable.</p>
<p>This way, you can run ildasm.exe from any command prompt in the future.</p>
<p><strong>Further Reading</strong></p>
<ul>
<li><a title="ildasm.exe Tutorial on MSDN" href="http://msdn.microsoft.com/en-us/library/aa309387(VS.71).aspx" target="_blank">ildasm.exe Tutorial on MSDN</a></li>
<li><a title="ildasm.exe Execution Parameters (Command Line Arguments) on MSDN" href="http://msdn.microsoft.com/en-us/library/f7dy01k1(VS.80).aspx" target="_blank">ildasm.exe Execution Parameters (Command Line Arguments) on MSDN</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://mycodetrip.com/2008/09/23/where-is-ildasm-exe-mil-disassembler-located-2-35_95/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Safest, Most Efficient Way To Clear A StringBuilder Variable</title>
		<link>http://mycodetrip.com/2008/09/17/safest-most-efficient-way-to-clear-a-stringbuilder-variable_10/</link>
		<comments>http://mycodetrip.com/2008/09/17/safest-most-efficient-way-to-clear-a-stringbuilder-variable_10/#comments</comments>
		<pubDate>Thu, 18 Sep 2008 04:02:30 +0000</pubDate>
		<dc:creator>Shiva Manjunath</dc:creator>
				<category><![CDATA[Tips / HowTos]]></category>
		<category><![CDATA[.Net Framework]]></category>
		<category><![CDATA[Best Practices]]></category>

		<guid isPermaLink="false">http://mycodetrip.com/?p=10</guid>
		<description><![CDATA[The safest and most efficient way to clear a StringBuilder variable is as follows.]]></description>
			<content:encoded><![CDATA[<p>The safest and most efficient way to clear a <strong>StringBuilder </strong>variable is as follows</p>
<pre class="brush: csharp">
stringBuilder sbr = new StringBuilder();
// loop
// more code
// clear sbr variable
sbr.Length = 0;
</pre>
<p><strong>Why ?</strong></p>
<p>It is a well know fact in the .Net community that using StringBuilder for string concatenation and manipulation is far more efficient that using the string class. The problem arises when you need to clear the StringBuilder variable. For regular string variables, you would simply set the variable equal to &#8220;&#8221;. However, you cannot do that  with the StringBuilder class. Moreover, the StringBuilder does not have a Clear() method as one would expect.</p>
<p>So when using a <strong>StringBuilder </strong>in a loop, for example, to read from a DataReader and write to a FileStream line by line, you are left with atleast 3 choices.</p>
<ol>
<li>Use the <strong>Remove() </strong>method, to remove all the characters in the variable.</li>
<li>Use <strong>new </strong>to recreate a new instance of the StringBuilder</li>
<li>Use the <strong>Clear() </strong>method.</li>
</ol>
<p>Using the <strong>Remove()</strong> method is not efficient, and could also throw an error if your variable has no characters in it. Using <strong>new </strong>to recreate the instance is obviously a performance overhead. So Of these 3, I would recommend that the last option.</p>
<p>Using the <strong>Clear()</strong> method is the safest and most efficient !</p>
]]></content:encoded>
			<wfw:commentRss>http://mycodetrip.com/2008/09/17/safest-most-efficient-way-to-clear-a-stringbuilder-variable_10/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>What Are Strong Names For Assemblies ? How Do You Create And Use Them ?</title>
		<link>http://mycodetrip.com/2003/04/29/what-are-strong-names-for-assemblies-how-do-you-create-and-use-them_156/</link>
		<comments>http://mycodetrip.com/2003/04/29/what-are-strong-names-for-assemblies-how-do-you-create-and-use-them_156/#comments</comments>
		<pubDate>Wed, 30 Apr 2003 00:33:17 +0000</pubDate>
		<dc:creator>Shiva</dc:creator>
				<category><![CDATA[Tips / HowTos]]></category>
		<category><![CDATA[.Net Framework]]></category>
		<category><![CDATA[How To]]></category>

		<guid isPermaLink="false">http://mycodetrip.com/?p=156</guid>
		<description><![CDATA[A simple, but clear and very well written article by Mike Gunderloy discussing Strong Names for .Net Assemblies and Why we need them. ]]></description>
			<content:encoded><![CDATA[<p>In this simple, but clear and <a title="The Secrets of Strong Naming" href="http://www.ondotnet.com/pub/a/dotnet/2003/04/28/strongnaming.html" target="_blank">very well written article</a>, <strong>Mike Gunderloy</strong> discusses <strong>Strong Names for .Net Assemblies</strong> and Why we need them.</p>
<p>Highlights of the article include</p>
<ul>
<li>Strong Naming for Assembly Identity</li>
<li>What&#8217;s in a (Strong) Name ?</li>
<li>The Mechanics of Strong Naming</li>
<li>Keeping Secrets with Delay Signing</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://mycodetrip.com/2003/04/29/what-are-strong-names-for-assemblies-how-do-you-create-and-use-them_156/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

