<?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>simra &#187; C#</title>
	<atom:link href="http://www.simra.ch/category/csharp/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.simra.ch</link>
	<description>development &#38; design</description>
	<lastBuildDate>Fri, 26 Mar 2010 15:57:34 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>SIB (System Information Browser)</title>
		<link>http://www.simra.ch/2010/01/sib-system-information-browser/</link>
		<comments>http://www.simra.ch/2010/01/sib-system-information-browser/#comments</comments>
		<pubDate>Wed, 06 Jan 2010 13:22:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Downloads]]></category>
		<category><![CDATA[ManagementObject]]></category>
		<category><![CDATA[Win32]]></category>

		<guid isPermaLink="false">http://www.simra.ch/?p=1053</guid>
		<description><![CDATA[A small and portable tool to get information about the system.]]></description>
			<content:encoded><![CDATA[<p>A small and portable tool to get information about the system.<br />
<span id="more-1053"></span></p>
<p><a href="http://www.simra.ch/uploads/downloads/csharp/sib/screenshot_large.jpg" target="_blank"></p>
<div class="box-back">
<div class="box-con">
<img src="http://www.simra.ch/uploads/downloads/csharp/sib/screenshot_small.jpg" alt="Screenshot" title="Screenshot" width="320px"  height="181px" class="aligncenter" />
</div>
<div class="box-front"><span>front image</span></div>
</div>
<p></a></p>
<p>Download: <a href="http://www.simra.ch/uploads/downloads/csharp/sib/sib.zip">System Information Browser v.1.0</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.simra.ch/2010/01/sib-system-information-browser/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Windows Password Changer</title>
		<link>http://www.simra.ch/2009/12/windows-password-changer/</link>
		<comments>http://www.simra.ch/2009/12/windows-password-changer/#comments</comments>
		<pubDate>Thu, 17 Dec 2009 20:12:29 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Downloads]]></category>
		<category><![CDATA[Portfolio]]></category>
		<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[Domain]]></category>

		<guid isPermaLink="false">http://www.simra.ch/?p=1019</guid>
		<description><![CDATA[This is a small and very useful Tool to change the password of any account on your local computer or Active Directory. It's ideal for centrally managing the passwords of your Domain(s). ]]></description>
			<content:encoded><![CDATA[<p>This is a small and very useful Tool to change the password of any account on your local computer or Active Directory. It&#8217;s ideal for centrally managing the passwords of your Domain(s).<br />
<span id="more-1019"></span></p>
<p><a href="http://www.simra.ch/uploads/downloads/csharp/addressfinder/screenshot.jpg" target="_blank"></p>
<div class="box-back">
<div class="box-con">
<img src="http://www.simra.ch/uploads/downloads/csharp/wpc/printscreen_small.jpg" alt="Screenshot" title="Screenshot" width="271px"  height="195px" class="aligncenter" />
</div>
<div class="box-front"><span>front image</span></div>
</div>
<p></a></p>
<p>Download: <a href="http://www.simra.ch/uploads/downloads/csharp/wpc/wpc.zip">Windows Password Changer v.1.0</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.simra.ch/2009/12/windows-password-changer/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to get all domains in the Active Directory using C#</title>
		<link>http://www.simra.ch/2009/12/how-to-get-list-of-domains-in-active-directory-in-c/</link>
		<comments>http://www.simra.ch/2009/12/how-to-get-list-of-domains-in-active-directory-in-c/#comments</comments>
		<pubDate>Thu, 17 Dec 2009 10:01:40 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Code Snippets]]></category>

		<guid isPermaLink="false">http://www.simra.ch/?p=1008</guid>
		<description><![CDATA[The following C# function returns a list of all domains in the Active Directory using System.DirectoryServices.

private StringCollection GetDomains&#40;&#41;
&#123;
&#160; &#160; StringCollection domains= new StringCollection&#40;&#41;;
&#160; &#160; try
&#160; &#160; &#123;
&#160; &#160; &#160; &#160; DirectorySearcher ds= new DirectorySearcher&#40;&#34;objectCategory=Domain&#34;&#41;;
&#160; &#160; &#160; &#160; SearchResultCollection src= ds.FindAll&#40;&#41;;
&#160; &#160; &#160; &#160; foreach &#40;SearchResult rs in src&#41;
&#160; &#160; &#160; &#160; &#123;
&#160; &#160; &#160; &#160; [...]]]></description>
			<content:encoded><![CDATA[<p>The following C# function returns a list of all domains in the Active Directory using System.DirectoryServices.<br />
<span id="more-1008"></span></p>
<div class="codecolorer-container csharp default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;height:300px;"><div class="csharp codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0600FF;">private</span> StringCollection GetDomains<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />
<span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; StringCollection domains<span style="color: #008000;">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> StringCollection<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; <span style="color: #0600FF;">try</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; DirectorySearcher ds<span style="color: #008000;">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> DirectorySearcher<span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;objectCategory=Domain&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; SearchResultCollection src<span style="color: #008000;">=</span> ds.<span style="color: #0000FF;">FindAll</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">foreach</span> <span style="color: #000000;">&#40;</span>SearchResult rs <span style="color: #0600FF;">in</span> src<span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ResultPropertyCollection rpc<span style="color: #008000;">=</span> rs.<span style="color: #0000FF;">Properties</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">foreach</span><span style="color: #000000;">&#40;</span> <span style="color: #FF0000;">object</span> d <span style="color: #0600FF;">in</span> rpc<span style="color: #000000;">&#91;</span><span style="color: #666666;">&quot;name&quot;</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; domains.<span style="color: #0000FF;">Add</span><span style="color: #000000;">&#40;</span>d.<span style="color: #0000FF;">ToString</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #0600FF;">catch</span> <span style="color: #000000;">&#40;</span>Exception<span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #0600FF;">return</span> domains<span style="color: #008000;">;</span><br />
<span style="color: #000000;">&#125;</span></div></div>
]]></content:encoded>
			<wfw:commentRss>http://www.simra.ch/2009/12/how-to-get-list-of-domains-in-active-directory-in-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>char[] to String in C#</title>
		<link>http://www.simra.ch/2009/12/char-to-string-in-c/</link>
		<comments>http://www.simra.ch/2009/12/char-to-string-in-c/#comments</comments>
		<pubDate>Mon, 14 Dec 2009 12:13:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Char]]></category>
		<category><![CDATA[Convert]]></category>
		<category><![CDATA[String]]></category>

		<guid isPermaLink="false">http://www.simra.ch/?p=988</guid>
		<description><![CDATA[char[] is quite convenient if you&#8217;re reading file data using StreamReader, but it doesn&#8217;t offer the same functionality as string does. Here&#8217;s a easy way to convert char[] to String :

char&#91;&#93; buffer = new char&#91;1024&#93;;
String s = new String&#40;charBuf&#41;;
]]></description>
			<content:encoded><![CDATA[<p>char[] is quite convenient if you&#8217;re reading file data using StreamReader, but it doesn&#8217;t offer the same functionality as string does. Here&#8217;s a easy way to convert char[] to String :<br />
<span id="more-988"></span></p>
<div class="codecolorer-container csharp default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div class="csharp codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #FF0000;">char</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> buffer <span style="color: #008000;">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> <span style="color: #FF0000;">char</span><span style="color: #000000;">&#91;</span>1024<span style="color: #000000;">&#93;</span><span style="color: #008000;">;</span><br />
<span style="color: #FF0000;">String</span> s <span style="color: #008000;">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> <span style="color: #FF0000;">String</span><span style="color: #000000;">&#40;</span>charBuf<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span></div></div>
]]></content:encoded>
			<wfw:commentRss>http://www.simra.ch/2009/12/char-to-string-in-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Regular Expressions in C#</title>
		<link>http://www.simra.ch/2009/12/regular-expression-in-c/</link>
		<comments>http://www.simra.ch/2009/12/regular-expression-in-c/#comments</comments>
		<pubDate>Fri, 11 Dec 2009 19:48:51 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[innerhtml]]></category>
		<category><![CDATA[nested tags]]></category>
		<category><![CDATA[Regex]]></category>
		<category><![CDATA[RegularExpressions]]></category>

		<guid isPermaLink="false">http://www.simra.ch/?p=967</guid>
		<description><![CDATA[A regular expression is a pattern of text that describes what to match in a string. It serves as a filter to find what you&#8217;re looking for. The two main function of using regular expression is to match and to replace. The former determines if the pattern is in the string, and if so, find [...]]]></description>
			<content:encoded><![CDATA[<p>A regular expression is a pattern of text that describes what to match in a string. It serves as a filter to find what you&#8217;re looking for. The two main function of using regular expression is to match and to replace. The former determines if the pattern is in the string, and if so, find it. Replace changes the string according to the pattern to another pattern.<br />
<span id="more-967"></span></p>
<blockquote><p>You can use regular expression (Regex) in your C# (or any other .NET language) application by importing the namespace System.Text.RegularExpressions. </p></blockquote>
<p>The following examples show the usage of Regular Expressions in C#. I needed them in one of my project to find stuff on a website and I find them very useful. </p>
<p>Returns the innerHtml of a tag (i.e. div) with certain attributes (works with nested tags):</p>
<div class="codecolorer-container csharp default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div class="csharp codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0600FF;">public</span> <span style="color: #0600FF;">static</span> <span style="color: #FF0000;">String</span> GetInnerHtml<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">String</span> content, <span style="color: #FF0000;">String</span> tag, <span style="color: #FF0000;">String</span> attr<span style="color: #000000;">&#41;</span><br />
<span style="color: #000000;">&#123;</span><br />
&nbsp; Regex re <span style="color: #008000;">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> Regex<span style="color: #000000;">&#40;</span><span style="color: #666666;">@&quot;(&lt;&quot;</span> <span style="color: #008000;">+</span> tag <span style="color: #008000;">+</span> <span style="color: #666666;">&quot; &quot;</span> <span style="color: #008000;">+</span> attr <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;(.*?)&gt;).*?((?&lt;TAG&gt;&lt;&quot;</span> <span style="color: #008000;">+</span> tag <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;).*?(?&lt;-TAG&gt;&lt;/&quot;</span> <span style="color: #008000;">+</span> tag <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;&gt;))?(?(TAG)(?!))&lt;/&quot;</span> <span style="color: #008000;">+</span> tag <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;&gt;&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span><br />
&nbsp; <span style="color: #0600FF;">return</span> re.<span style="color: #0000FF;">Match</span><span style="color: #000000;">&#40;</span>content<span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">ToString</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span><br />
<span style="color: #000000;">&#125;</span></div></div>
<p>Returns all Email-Addresses:</p>
<div class="codecolorer-container csharp default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div class="csharp codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0600FF;">public</span> <span style="color: #0600FF;">static</span> <span style="color: #FF0000;">String</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> GetEmailAddresses<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">String</span> content<span style="color: #000000;">&#41;</span><br />
<span style="color: #000000;">&#123;</span><br />
&nbsp; Regex re <span style="color: #008000;">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> Regex<span style="color: #000000;">&#40;</span><span style="color: #666666;">@&quot;[\w\.-]{1,}@[\w\.-]{2,}\.\w{2,3}&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span><br />
&nbsp; MatchCollection emails <span style="color: #008000;">=</span> re.<span style="color: #0000FF;">Matches</span><span style="color: #000000;">&#40;</span>content<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span><br />
&nbsp; <span style="color: #FF0000;">String</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> s <span style="color: #008000;">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> <span style="color: #FF0000;">string</span><span style="color: #000000;">&#91;</span>emails.<span style="color: #0000FF;">Count</span><span style="color: #000000;">&#93;</span><span style="color: #008000;">;</span><br />
&nbsp; <span style="color: #0600FF;">for</span> <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">int</span> x <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">;</span> x <span style="color: #008000;">&lt;</span> emails.<span style="color: #0000FF;">Count</span><span style="color: #008000;">;</span> x<span style="color: #008000;">++</span><span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; s<span style="color: #000000;">&#91;</span>x<span style="color: #000000;">&#93;</span> <span style="color: #008000;">=</span> emails<span style="color: #000000;">&#91;</span>x<span style="color: #000000;">&#93;</span>.<span style="color: #0000FF;">ToString</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span><br />
&nbsp; <span style="color: #0600FF;">return</span> s<span style="color: #008000;">;</span><br />
<span style="color: #000000;">&#125;</span></div></div>
<p>Removes all tags:</p>
<div class="codecolorer-container csharp default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div class="csharp codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0600FF;">public</span> <span style="color: #0600FF;">static</span> <span style="color: #FF0000;">String</span> RemoveTags<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">String</span> content<span style="color: #000000;">&#41;</span><br />
<span style="color: #000000;">&#123;</span><br />
&nbsp; Regex re <span style="color: #008000;">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> Regex<span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;(&lt;[^&gt;]*&gt;)&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span><br />
&nbsp; content <span style="color: #008000;">=</span> re.<span style="color: #0000FF;">Replace</span><span style="color: #000000;">&#40;</span>content, <span style="color: #666666;">&quot;&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span><br />
&nbsp; <span style="color: #0600FF;">return</span> content<span style="color: #008000;">;</span><br />
<span style="color: #000000;">&#125;</span></div></div>
<p>Returns the title tag:</p>
<div class="codecolorer-container csharp default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><div class="csharp codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0600FF;">public</span> <span style="color: #0600FF;">static</span> <span style="color: #FF0000;">String</span> GetTitle<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">String</span> content<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span><br />
&nbsp; Regex re <span style="color: #008000;">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> Regex<span style="color: #000000;">&#40;</span><span style="color: #666666;">@&quot;(?&lt;=&lt;title.*&gt;)([\s\S]*)(?=&lt;/title&gt;)&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span><br />
&nbsp; <span style="color: #0600FF;">return</span> re.<span style="color: #0000FF;">Match</span><span style="color: #000000;">&#40;</span>content<span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">ToString</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span><br />
<span style="color: #000000;">&#125;</span></div></div>
]]></content:encoded>
			<wfw:commentRss>http://www.simra.ch/2009/12/regular-expression-in-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Get the content of an url in C#</title>
		<link>http://www.simra.ch/2009/12/get-the-content-of-url-c/</link>
		<comments>http://www.simra.ch/2009/12/get-the-content-of-url-c/#comments</comments>
		<pubDate>Tue, 08 Dec 2009 21:26:43 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[HttpWebRequest]]></category>
		<category><![CDATA[url content]]></category>

		<guid isPermaLink="false">http://www.simra.ch/?p=962</guid>
		<description><![CDATA[This is a easy way to get the content of a url into a string. You only need to open a new connection using HttpWebRequest, make a request and read the stream into a string. see the example below:

using System;
using System.Net;
using System.IO;

class functions
&#123;
&#160; public static String GetUrlContent&#40;String Url&#41;
&#160; &#123;
&#160; &#160; &#160; // Open a connection
&#160; [...]]]></description>
			<content:encoded><![CDATA[<p>This is a easy way to get the content of a url into a string. You only need to open a new connection using HttpWebRequest, make a request and read the stream into a string. see the example below:<br />
<span id="more-962"></span></p>
<div class="codecolorer-container csharp default" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;height:300px;"><div class="csharp codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0600FF;">using</span> <span style="color: #008080;">System</span><span style="color: #008000;">;</span><br />
<span style="color: #0600FF;">using</span> <span style="color: #008080;">System.Net</span><span style="color: #008000;">;</span><br />
<span style="color: #0600FF;">using</span> <span style="color: #008080;">System.IO</span><span style="color: #008000;">;</span><br />
<br />
<span style="color: #FF0000;">class</span> functions<br />
<span style="color: #000000;">&#123;</span><br />
&nbsp; <span style="color: #0600FF;">public</span> <span style="color: #0600FF;">static</span> <span style="color: #FF0000;">String</span> GetUrlContent<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">String</span> Url<span style="color: #000000;">&#41;</span><br />
&nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Open a connection</span><br />
&nbsp; &nbsp; &nbsp; HttpWebRequest hwr <span style="color: #008000;">=</span> <span style="color: #000000;">&#40;</span>HttpWebRequest<span style="color: #000000;">&#41;</span>HttpWebRequest.<span style="color: #0000FF;">Create</span><span style="color: #000000;">&#40;</span>Url<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />
&nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Specify header information like </span><br />
&nbsp; &nbsp; &nbsp; hwr.<span style="color: #0000FF;">UserAgent</span> <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;simra.ch GetUrlContent&quot;</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; hwr.<span style="color: #0000FF;">Referer</span> <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;http://www.simra.ch/&quot;</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />
&nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Get the Request</span><br />
&nbsp; &nbsp; &nbsp; WebResponse wr <span style="color: #008000;">=</span> hwr.<span style="color: #0000FF;">GetResponse</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />
&nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Open a new Stream</span><br />
&nbsp; &nbsp; &nbsp; Stream ws <span style="color: #008000;">=</span> wr.<span style="color: #0000FF;">GetResponseStream</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />
&nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Create a SteamReader</span><br />
&nbsp; &nbsp; &nbsp; StreamReader sr <span style="color: #008000;">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> StreamReader<span style="color: #000000;">&#40;</span>ws<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />
&nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Read the stream</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #FF0000;">String</span> content <span style="color: #008000;">=</span> sr.<span style="color: #0000FF;">ReadToEnd</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />
&nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Cleanup</span><br />
&nbsp; &nbsp; &nbsp; sr.<span style="color: #0000FF;">Close</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; ws.<span style="color: #0000FF;">Close</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; wr.<span style="color: #0000FF;">Close</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">return</span> content<span style="color: #008000;">;</span><br />
&nbsp; <span style="color: #000000;">&#125;</span><br />
<span style="color: #000000;">&#125;</span></div></div>
]]></content:encoded>
			<wfw:commentRss>http://www.simra.ch/2009/12/get-the-content-of-url-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ip-Address Range Pinger</title>
		<link>http://www.simra.ch/2009/11/ip-address-range-pinger/</link>
		<comments>http://www.simra.ch/2009/11/ip-address-range-pinger/#comments</comments>
		<pubDate>Fri, 27 Nov 2009 21:46:19 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Downloads]]></category>
		<category><![CDATA[Portfolio]]></category>
		<category><![CDATA[dns]]></category>
		<category><![CDATA[gateway]]></category>
		<category><![CDATA[hostname]]></category>
		<category><![CDATA[ip-address range]]></category>
		<category><![CDATA[network card]]></category>
		<category><![CDATA[NIC]]></category>
		<category><![CDATA[ping]]></category>
		<category><![CDATA[subnet]]></category>

		<guid isPermaLink="false">http://www.simra.ch/?p=791</guid>
		<description><![CDATA[Das folgende Tool ist sehr nützlich, um Geräte im aktuellen Neztbereich zu suchen. Anhand der Ip-Adresse und der Subnetzmaske wird der Ip-Range bestimmt. Mit der Funktion <strong>Ping Range</strong> kann der gesamte Bereich gepingt werden. Geräte die Antwort geben, werden im Protokoll aufgeführt. ]]></description>
			<content:encoded><![CDATA[<p>Das folgende Tool ist sehr nützlich um Geräte im aktuellen Neztbereich zu suchen. Anhand der Ip-Adresse und der Subnetzmaske wird der Ip-Range bestimmt. Mit der Funktion <strong>Ping Range</strong> kann der gesamte Bereich gepingt werden. Geräte die Antwort geben, werden im Protokoll aufgeführt. Für 255 Pings braucht das Programm durchschnittlich weniger als 1 Sekunde!<br />
<span id="more-791"></span></p>
<p><a href="http://www.simra.ch/uploads/downloads/csharp/ping/printscreen.jpg" target="_blank"></p>
<div class="box-back">
<div class="box-con">
<img src="http://www.simra.ch/uploads/downloads/csharp/ping/printscreen.jpg" alt="Flash AS3 Gallery Printscreen" title="Flash AS3 Gallery Printscreen" width="75%"  class="alignnone" />
</div>
<div class="box-front"><span>front image</span></div>
</div>
<p></a></p>
<p>Download <a href="http://www.simra.ch/uploads/downloads/csharp/ping/ping.zip">Ip-Address Range Pinger v.1.0</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.simra.ch/2009/11/ip-address-range-pinger/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

