<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>C# Frequently Asked Questions : .NET Framework</title><link>http://blogs.msdn.com/csharpfaq/archive/tags/.NET+Framework/default.aspx</link><description>Tags: .NET Framework</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>How do I calculate a MD5 hash from a string?</title><link>http://blogs.msdn.com/csharpfaq/archive/2006/10/09/How-do-I-calculate-a-MD5-hash-from-a-string_3F00_.aspx</link><pubDate>Tue, 10 Oct 2006 02:15:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:810522</guid><dc:creator>CSharpFAQ</dc:creator><slash:comments>4</slash:comments><comments>http://blogs.msdn.com/csharpfaq/comments/810522.aspx</comments><wfw:commentRss>http://blogs.msdn.com/csharpfaq/commentrss.aspx?PostID=810522</wfw:commentRss><description>&lt;P&gt;It is a common practice to store passwords in databases using a hash. MD5 (defined in &lt;A href="http://www.ietf.org/rfc/rfc1321.txt" mce_href="http://www.ietf.org/rfc/rfc1321.txt"&gt;RFC 1321&lt;/A&gt;) is a common hash algorithm, and using it from C# is easy.&lt;/P&gt;
&lt;P&gt;Here’s an implementation of a method that converts a string to an MD5 hash, which is a 32-character string of hexadecimal numbers.&lt;/P&gt;&lt;PRE&gt;public string CalculateMD5Hash(string input)
{
    // step 1, calculate MD5 hash from input
    MD5 md5 = System.Security.Cryptography.MD5.Create();
    byte[] inputBytes = System.Text.Encoding.ASCII.GetBytes(input);
    byte[] hash = md5.ComputeHash(inputBytes);
 
    // step 2, convert byte array to hex string
    StringBuilder sb = new StringBuilder();
    for (int i = 0; i &amp;lt; hash.Length; i++)
    {
        sb.Append(hash[i].ToString("X2"));
    }
    return sb.ToString();
}
&lt;/PRE&gt;
&lt;P&gt;An example call:&lt;/P&gt;&lt;PRE&gt;string hash = CalculateMD5Hash("abcdefghijklmnopqrstuvwxyz");&lt;/PRE&gt;
&lt;P&gt;…returns a string like this:&lt;/P&gt;&lt;PRE&gt;C3FCD3D76192E4007DFB496CCA67E13B&lt;/PRE&gt;
&lt;P&gt;To make the hex string use lower-case letters instead of upper-case, replace the single line inside the &lt;EM&gt;for &lt;/EM&gt;loop with this line:&lt;/P&gt;&lt;PRE&gt;sb.Append(hash[i].ToString("x2"));&lt;/PRE&gt;
&lt;P&gt;The difference is the ToString method parameter.&lt;/P&gt;
&lt;P&gt;[author: &lt;A href="http://www.saunalahti.fi/janij/" mce_href="http://www.saunalahti.fi/janij/"&gt;Jani Järvinen&lt;/A&gt;, C# MVP]&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=810522" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/csharpfaq/archive/tags/.NET+Framework/default.aspx">.NET Framework</category></item><item><title>How do I play default Windows sounds?</title><link>http://blogs.msdn.com/csharpfaq/archive/2006/03/27/562557.aspx</link><pubDate>Tue, 28 Mar 2006 05:03:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:562557</guid><dc:creator>CSharpFAQ</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/csharpfaq/comments/562557.aspx</comments><wfw:commentRss>http://blogs.msdn.com/csharpfaq/commentrss.aspx?PostID=562557</wfw:commentRss><description>&lt;P&gt;Sometimes, you might want to make your application a bit more audible. If you are using .NET 2.0, you can utilize the new System.Media namespace and its SystemSound and SystemSounds classes.&lt;/P&gt;
&lt;P&gt;The SystemSounds class contains five static properties that you can use to retrieve instances of the SystemSound class. This class in turn contains the Play() method, which you can use to play the wave file associated with the sound in Windows Control Panel. Note that the user can also disable all sounds altogether, which would mean that no sound can be heard through the computer speakers.&lt;/P&gt;
&lt;P&gt;To play for example the classical beep sound, you could use the following code:&lt;/P&gt;&lt;PRE&gt;System.Media.SystemSounds.Beep.Play();&lt;/PRE&gt;
&lt;P&gt;Similarly, you could play the “Question” sound with this code:&lt;/P&gt;&lt;PRE&gt;System.Media.SystemSounds.Question.Play();&lt;/PRE&gt;
&lt;P&gt;The System.Media namespace is defined in System.dll, so there are no new DLLs you would need to add to your project’s references to use the above code.&lt;/P&gt;
&lt;P&gt;[author: &lt;A href="http://www.saunalahti.fi/janij/"&gt;Jani Järvinen&lt;/A&gt;, C# MVP]&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=562557" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/csharpfaq/archive/tags/.NET+Framework/default.aspx">.NET Framework</category></item><item><title>Where can I find design and coding guidelines for .NET?</title><link>http://blogs.msdn.com/csharpfaq/archive/2005/02/21/377598.aspx</link><pubDate>Mon, 21 Feb 2005 21:30:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:377598</guid><dc:creator>CSharpFAQ</dc:creator><slash:comments>5</slash:comments><comments>http://blogs.msdn.com/csharpfaq/comments/377598.aspx</comments><wfw:commentRss>http://blogs.msdn.com/csharpfaq/commentrss.aspx?PostID=377598</wfw:commentRss><description>&lt;p&gt;&lt;font face="Arial"&gt;tipu_77 asked "What are microsoft suggested naming conventions in C#?"&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;span id="qd_lblAnswer" style="FONT-SIZE: x-small"&gt;&lt;font face="Arial" size="3"&gt;The .NET Framework Team collects their recommendations at their&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="FONT-SIZE: x-small"&gt;&lt;a href="http://www.gotdotnet.com/team/libraries/"&gt;&lt;font face="Arial" size="3"&gt;GotDotNet community site&lt;/font&gt;&lt;/a&gt;&lt;font face="Arial" size="3"&gt;. &lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="FONT-SIZE: x-small"&gt;&lt;font face="Arial" size="3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="FONT-SIZE: x-small"&gt;&lt;font face="Arial" size="3"&gt;which points to a fairly comprehensive MSDN page&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="FONT-SIZE: x-small"&gt;&lt;font face="Arial" size="3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="FONT-SIZE: x-small"&gt;&lt;a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/cpconnetframeworkdesignguidelines.asp"&gt;&lt;font face="Arial" size="3"&gt;Design Guidelines for Class Library Developers&lt;/font&gt;&lt;/a&gt;&lt;font face="Arial" size="3"&gt;.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="FONT-SIZE: x-small"&gt;&lt;font face="Arial" size="3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; which includes the section &lt;/font&gt;&lt;/span&gt;&lt;span style="FONT-SIZE: x-small"&gt;&lt;a href="http://msdn.microsoft.com/library/en-us/cpgenref/html/cpconnamingguidelines.asp"&gt;&lt;font face="Arial" size="3"&gt;Naming Guidelines&lt;/font&gt;&lt;/a&gt;&lt;font face="Arial" size="3"&gt; &lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="FONT-SIZE: x-small"&gt;&lt;font face="Arial" size="3"&gt;&lt;/font&gt;&amp;nbsp;&lt;/p&gt;&lt;/span&gt; &lt;p&gt;&lt;span style="FONT-SIZE: x-small"&gt;&lt;font face="Arial" size="3"&gt;[Author: SantoshZ]&lt;br /&gt;&lt;/font&gt;&lt;/p&gt;&lt;/span&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=377598" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/csharpfaq/archive/tags/C_2300_+Language+and+Compiler/default.aspx">C# Language and Compiler</category><category domain="http://blogs.msdn.com/csharpfaq/archive/tags/.NET+Framework/default.aspx">.NET Framework</category></item><item><title>How do I get and set Environment variables?</title><link>http://blogs.msdn.com/csharpfaq/archive/2004/12/02/273785.aspx</link><pubDate>Thu, 02 Dec 2004 17:01:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:273785</guid><dc:creator>CSharpFAQ</dc:creator><slash:comments>6</slash:comments><comments>http://blogs.msdn.com/csharpfaq/comments/273785.aspx</comments><wfw:commentRss>http://blogs.msdn.com/csharpfaq/commentrss.aspx?PostID=273785</wfw:commentRss><description>&lt;p align="left"&gt;&lt;span id="qd_lblAnswer" style="FONT-SIZE: x-small"&gt;&lt;font face="Arial" size="3"&gt;Use the &lt;b&gt;System.Environment&lt;/b&gt; class.&lt;br /&gt;Specifically the &lt;b&gt;GetEnvironmentVariable&lt;/b&gt; and &lt;b&gt;SetEnvironmentVariable&lt;/b&gt; methods.&lt;br /&gt;&lt;br /&gt;&lt;/font&gt;&lt;/span&gt;&lt;font face="Arial"&gt;Admitedly, this is not a question specific to C#, but it is one I have seen enough C# programmers ask, and the ability to &lt;em&gt;set &lt;/em&gt;environment variables is new to the Whidbey release, as is the &lt;b&gt;EnvironmentVariableTarget&lt;/b&gt; enumeration which lets you separately specify process, machine, and user. &lt;/font&gt;&lt;/p&gt; &lt;p align="left"&gt;&lt;font face="Arial"&gt;Brad Abrams blogged on &lt;a href="http://weblogs.asp.net/brada/archive/2004/01/03/50984.aspx"&gt;this&lt;/a&gt; way back at the start of this year, and followed up with a&amp;nbsp;&lt;a href="http://weblogs.asp.net/brada/archive/2004/02/23/78870.aspx"&gt;solution &lt;/a&gt;for pre-Whidbey users.&lt;/font&gt;&lt;/p&gt; &lt;p align="left"&gt;&lt;font face="Arial"&gt;[Author: SantoshZ]&lt;/font&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=273785" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/csharpfaq/archive/tags/General/default.aspx">General</category><category domain="http://blogs.msdn.com/csharpfaq/archive/tags/.NET+Framework/default.aspx">.NET Framework</category><category domain="http://blogs.msdn.com/csharpfaq/archive/tags/Tips/default.aspx">Tips</category></item><item><title>What is the equivalent to regsvr32 in .NET? </title><link>http://blogs.msdn.com/csharpfaq/archive/2004/08/02/206158.aspx</link><pubDate>Mon, 02 Aug 2004 21:15:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:206158</guid><dc:creator>CSharpFAQ</dc:creator><slash:comments>9</slash:comments><comments>http://blogs.msdn.com/csharpfaq/comments/206158.aspx</comments><wfw:commentRss>http://blogs.msdn.com/csharpfaq/commentrss.aspx?PostID=206158</wfw:commentRss><description>&lt;P&gt;&lt;SPAN id=qd_lblAnswer style="FONT-SIZE: x-small"&gt;&lt;FONT face=Arial size=3&gt;Where you once used &lt;STRONG&gt;Regsvr32&lt;/STRONG&gt; on unmanaged COM libraries, you will now use &lt;STRONG&gt;Regasm&lt;/STRONG&gt; on managed .NET libraries.&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: x-small"&gt;&lt;FONT face=Arial size=3&gt;&amp;#8220;&lt;/FONT&gt;&lt;A href="http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/regsvr32.mspx"&gt;&lt;FONT face=Arial size=3&gt;Regsvr32 &lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Arial size=3&gt;is&amp;nbsp;the command-line tool that registers .dll files as command components in the registry&amp;#8220;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: x-small"&gt;&lt;/P&gt;
&lt;DIV id=nstext valign="bottom"&gt;
&lt;DIV&gt;&lt;FONT face=Arial size=3&gt;&amp;#8220;Regasm.exe, the &lt;/FONT&gt;&lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cptools/html/cpgrfassemblyregistrationtoolregasmexe.asp"&gt;&lt;FONT face=Arial size=3&gt;Assembly Registration tool &lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Arial size=3&gt;that comes with the .NET SDK,&amp;nbsp; reads the metadata within an assembly and adds the necessary entries to the registry, which allows COM clients to create .NET Framework classes transparently. Once a class is registered, any COM client can use it as though the class were a COM class. The class is registered only once, when the assembly is installed. Instances of classes within the assembly cannot be created from COM until they are actually registered.&amp;#8220;&lt;/FONT&gt;&lt;/DIV&gt;&lt;FONT&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;&lt;FONT size=3&gt;If you want to register an assembly programmatically, see the&amp;nbsp;&lt;/FONT&gt;&lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemruntimeinteropservicesregistrationservicesclasstopic.asp"&gt;&lt;FONT size=3&gt;RegistrationServices class&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3&gt;&amp;nbsp;and &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT&gt;&lt;FONT face=Arial size=3&gt;&lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemruntimeinteropservicescomregisterfunctionattributeclasstopic.asp"&gt;ComRegisterFunctionAttribute&lt;/A&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;DIV valign="bottom"&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size=3&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=206158" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/csharpfaq/archive/tags/.NET+Framework/default.aspx">.NET Framework</category></item><item><title>How can I run another application or batch file from my Visual C# .NET code?</title><link>http://blogs.msdn.com/csharpfaq/archive/2004/06/01/146375.aspx</link><pubDate>Wed, 02 Jun 2004 06:54:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:146375</guid><dc:creator>CSharpFAQ</dc:creator><slash:comments>18</slash:comments><comments>http://blogs.msdn.com/csharpfaq/comments/146375.aspx</comments><wfw:commentRss>http://blogs.msdn.com/csharpfaq/commentrss.aspx?PostID=146375</wfw:commentRss><description>&lt;P&gt;Posted by: &lt;A href="http://weblogs.asp.net/duncanma"&gt;Duncan Mackenzie&lt;/A&gt;, MSDN&lt;BR&gt;&lt;EM&gt;This post applies to Visual&amp;nbsp;C# .NET 2002/2003&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;Suppose you want to run a command line application,&amp;nbsp;open up another Windows program, or even bring up the default web browser or email program... &lt;STRONG&gt;how can you do this from your&amp;nbsp;C# code?&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;The answer for all of these examples is the same, you can use the classes and methods in &lt;A href="http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemDiagnosticsProcessClassTopic.asp"&gt;System.Diagnostics.Process&lt;/A&gt; to accomplish these tasks and more.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Example 1.&lt;/STRONG&gt; Running a command line application, without concern for the results:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN style="FONT-WEIGHT: 400; FONT-SIZE: 12px; COLOR: #0000ff; FONT-FAMILY: Courier New"&gt;private&lt;/SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: 400; FONT-SIZE: 12px; COLOR: #0000ff; FONT-FAMILY: Courier New"&gt;void&lt;/SPAN&gt;&lt;SPAN&gt; simpleRun_Click(&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: 400; FONT-SIZE: 12px; COLOR: #0000ff; FONT-FAMILY: Courier New"&gt;object&lt;/SPAN&gt;&lt;SPAN&gt; sender, System.EventArgs e)&lt;/SPAN&gt;&lt;SPAN&gt;{&lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;System.Diagnostics.Process.Start(@&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: 400; FONT-SIZE: 12px; COLOR: #ff0000; FONT-FAMILY: Courier New"&gt;"C:\listfiles.bat"&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;BR&gt;}&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;STRONG&gt;Example 2.&lt;/STRONG&gt; Retrieving the results and waiting until the process stops (running the process synchronously):&lt;/P&gt;&lt;PRE&gt;&lt;SPAN style="FONT-WEIGHT: 400; FONT-SIZE: 12px; COLOR: #0000ff; FONT-FAMILY: Courier New"&gt;private&lt;/SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: 400; FONT-SIZE: 12px; COLOR: #0000ff; FONT-FAMILY: Courier New"&gt;void&lt;/SPAN&gt;&lt;SPAN&gt; runSyncAndGetResults_Click(&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: 400; FONT-SIZE: 12px; COLOR: #0000ff; FONT-FAMILY: Courier New"&gt;object&lt;/SPAN&gt;&lt;SPAN&gt; sender, System.EventArgs e){&lt;BR&gt;&amp;nbsp;System.Diagnostics.ProcessStartInfo psi =&lt;BR&gt; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: 400; FONT-SIZE: 12px; COLOR: #0000ff; FONT-FAMILY: Courier New"&gt;new&lt;/SPAN&gt;&lt;SPAN&gt; System.Diagnostics.ProcessStartInfo(@&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: 400; FONT-SIZE: 12px; COLOR: #ff0000; FONT-FAMILY: Courier New"&gt;"C:\listfiles.bat"&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;BR&gt;&amp;nbsp;psi.RedirectStandardOutput = &lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: 400; FONT-SIZE: 12px; COLOR: #0000ff; FONT-FAMILY: Courier New"&gt;true&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;BR&gt;&amp;nbsp;psi.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;&lt;BR&gt;&amp;nbsp;psi.UseShellExecute = &lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: 400; FONT-SIZE: 12px; COLOR: #0000ff; FONT-FAMILY: Courier New"&gt;false&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;BR&gt;&amp;nbsp;System.Diagnostics.Process listFiles;&lt;BR&gt;&amp;nbsp;listFiles = System.Diagnostics.Process.Start(psi);&lt;BR&gt;&amp;nbsp;System.IO.StreamReader myOutput = listFiles.StandardOutput;&lt;BR&gt;&amp;nbsp;listFiles.WaitForExit(2000);&lt;BR&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: 400; FONT-SIZE: 12px; COLOR: #0000ff; FONT-FAMILY: Courier New"&gt;if&lt;/SPAN&gt;&lt;SPAN&gt; (listFiles.HasExited)&lt;BR&gt; &amp;nbsp;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: 400; FONT-SIZE: 12px; COLOR: #0000ff; FONT-FAMILY: Courier New"&gt;string&lt;/SPAN&gt;&lt;SPAN&gt; output = myOutput.ReadToEnd();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: 400; FONT-SIZE: 12px; COLOR: #0000ff; FONT-FAMILY: Courier New"&gt;this&lt;/SPAN&gt;&lt;SPAN&gt;.processResults.Text = output;&lt;BR&gt;&amp;nbsp;}&lt;BR&gt;}&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;STRONG&gt;Example 3.&lt;/STRONG&gt; Displaying a URL using the default browser on the user's machine:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN style="FONT-WEIGHT: 400; FONT-SIZE: 12px; COLOR: #0000ff; FONT-FAMILY: Courier New"&gt;private&lt;/SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: 400; FONT-SIZE: 12px; COLOR: #0000ff; FONT-FAMILY: Courier New"&gt;void&lt;/SPAN&gt;&lt;SPAN&gt; launchURL_Click(&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: 400; FONT-SIZE: 12px; COLOR: #0000ff; FONT-FAMILY: Courier New"&gt;object&lt;/SPAN&gt;&lt;SPAN&gt; sender, System.EventArgs e){&lt;BR&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: 400; FONT-SIZE: 12px; COLOR: #0000ff; FONT-FAMILY: Courier New"&gt;string&lt;/SPAN&gt;&lt;SPAN&gt; targetURL = @&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: 400; FONT-SIZE: 12px; COLOR: #ff0000; FONT-FAMILY: Courier New"&gt;&lt;A href="http://www.duncanmackenzie.net"&gt;http://www.duncanmackenzie.net&lt;/A&gt;&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;BR&gt;&amp;nbsp;System.Diagnostics.Process.Start(targetURL);&lt;BR&gt;}&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;P&gt;In my opinion, you are much better off following the third example for URLs, as opposed to executing IE with the URL as an argument. The code shown for Example 3 will launch the user's default browser, which may or may not be IE; you are more likely to provide the user with the experience they want and&amp;nbsp;you will be taking advantage of the browser that is most likely to have up-to-date connection information.&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;C# code download available&amp;nbsp;from &lt;A href="http://www.duncanmackenzie.net/Samples/default.aspx"&gt;http://www.duncanmackenzie.net/Samples/default.aspx&lt;/A&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;By the way, this post is a simple port of &lt;/EM&gt;&lt;A href="http://blogs.msdn.com/vbfaq/archive/2004/05/30/144573.aspx"&gt;&lt;EM&gt;an earlier VB FAQ post&lt;/EM&gt;&lt;/A&gt;&lt;EM&gt;... just in case you thought you had seen it already in your feeds...&lt;/EM&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=146375" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/csharpfaq/archive/tags/.NET+Framework/default.aspx">.NET Framework</category></item></channel></rss>