<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Adding &#8220;Check for update&#8221; feature to your C# application</title>
	<atom:link href="http://themech.net/2008/05/adding-check-for-update-option-in-csharp/feed/" rel="self" type="application/rss+xml" />
	<link>http://themech.net/2008/05/adding-check-for-update-option-in-csharp/</link>
	<description>Python, software development, stock exchange, C#</description>
	<lastBuildDate>Mon, 23 Aug 2010 18:21:30 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: mech</title>
		<link>http://themech.net/2008/05/adding-check-for-update-option-in-csharp/comment-page-1/#comment-10063</link>
		<dc:creator>mech</dc:creator>
		<pubDate>Tue, 10 Aug 2010 08:31:47 +0000</pubDate>
		<guid isPermaLink="false">http://themech.net/?p=8#comment-10063</guid>
		<description>Steve,
Your C# compiler seems to be more strict :) Please try initializing the variable before the try...finally block like this:
XmlTextReader reader = null;</description>
		<content:encoded><![CDATA[<p>Steve,<br />
Your C# compiler seems to be more strict :) Please try initializing the variable before the try&#8230;finally block like this:<br />
XmlTextReader reader = null;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve</title>
		<link>http://themech.net/2008/05/adding-check-for-update-option-in-csharp/comment-page-1/#comment-9581</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Sat, 24 Jul 2010 14:49:55 +0000</pubDate>
		<guid isPermaLink="false">http://themech.net/?p=8#comment-9581</guid>
		<description>I get a error here:

finally
            {
                if (reader != null) reader.Close();
            }

It says &quot;Error use of unsigned local variable &quot;reader&quot;</description>
		<content:encoded><![CDATA[<p>I get a error here:</p>
<p>finally<br />
            {<br />
                if (reader != null) reader.Close();<br />
            }</p>
<p>It says &#8220;Error use of unsigned local variable &#8220;reader&#8221;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jorge Sierra</title>
		<link>http://themech.net/2008/05/adding-check-for-update-option-in-csharp/comment-page-1/#comment-8316</link>
		<dc:creator>Jorge Sierra</dc:creator>
		<pubDate>Mon, 26 Apr 2010 19:05:59 +0000</pubDate>
		<guid isPermaLink="false">http://themech.net/?p=8#comment-8316</guid>
		<description>Well, I did some test and it works great.
  Let me include it on my project.</description>
		<content:encoded><![CDATA[<p>Well, I did some test and it works great.<br />
  Let me include it on my project.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: miliu</title>
		<link>http://themech.net/2008/05/adding-check-for-update-option-in-csharp/comment-page-1/#comment-7564</link>
		<dc:creator>miliu</dc:creator>
		<pubDate>Wed, 03 Mar 2010 15:10:53 +0000</pubDate>
		<guid isPermaLink="false">http://themech.net/?p=8#comment-7564</guid>
		<description>Thanks for the nice article. I found it when I try to make VS publishing and CheckForUpdate work together. Do you have any thought on that?

By the way, on parsing out the version info from the xml file, it would be much easier using XPath. e.g.
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(xmlUrl);
Version version = new Version(xmlDoc.SelectSingleNode(&quot;/ourfancyapp/version&quot;).InnerText);
string url = xmlDoc.SelectSingleNode(&quot;/ourfancyapp/url&quot;).InnerText;</description>
		<content:encoded><![CDATA[<p>Thanks for the nice article. I found it when I try to make VS publishing and CheckForUpdate work together. Do you have any thought on that?</p>
<p>By the way, on parsing out the version info from the xml file, it would be much easier using XPath. e.g.<br />
XmlDocument xmlDoc = new XmlDocument();<br />
xmlDoc.Load(xmlUrl);<br />
Version version = new Version(xmlDoc.SelectSingleNode(&#8220;/ourfancyapp/version&#8221;).InnerText);<br />
string url = xmlDoc.SelectSingleNode(&#8220;/ourfancyapp/url&#8221;).InnerText;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Fullmetal</title>
		<link>http://themech.net/2008/05/adding-check-for-update-option-in-csharp/comment-page-1/#comment-6994</link>
		<dc:creator>Fullmetal</dc:creator>
		<pubDate>Mon, 25 Jan 2010 19:15:49 +0000</pubDate>
		<guid isPermaLink="false">http://themech.net/?p=8#comment-6994</guid>
		<description>I used this code along with a downloader request code, and now the application checks the XML, and if there is an update, will ask if its OK to download it. it will then download it and install the Update. I am planning on adding a &quot;update from USB drive&quot; option that will check the drive for the XML file, and if the version is a newer one, install the update package from the USB drive.</description>
		<content:encoded><![CDATA[<p>I used this code along with a downloader request code, and now the application checks the XML, and if there is an update, will ask if its OK to download it. it will then download it and install the Update. I am planning on adding a &#8220;update from USB drive&#8221; option that will check the drive for the XML file, and if the version is a newer one, install the update package from the USB drive.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mech</title>
		<link>http://themech.net/2008/05/adding-check-for-update-option-in-csharp/comment-page-1/#comment-6935</link>
		<dc:creator>mech</dc:creator>
		<pubDate>Tue, 19 Jan 2010 11:38:19 +0000</pubDate>
		<guid isPermaLink="false">http://themech.net/?p=8#comment-6935</guid>
		<description>Hello,

@OverTech: Yes, indeed, HttpWebRequest gives you more tcp/ip control than XmlTextReader does. I&#039;ve checked your code snippet and it seems fine to be, well done :)

@Ranhiru: You should host two files: the XML and your installer for the new version, so users can download it. Luckily there are some free web hosting services that allow you to do so.</description>
		<content:encoded><![CDATA[<p>Hello,</p>
<p>@OverTech: Yes, indeed, HttpWebRequest gives you more tcp/ip control than XmlTextReader does. I&#8217;ve checked your code snippet and it seems fine to be, well done :)</p>
<p>@Ranhiru: You should host two files: the XML and your installer for the new version, so users can download it. Luckily there are some free web hosting services that allow you to do so.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ranhiru</title>
		<link>http://themech.net/2008/05/adding-check-for-update-option-in-csharp/comment-page-1/#comment-6902</link>
		<dc:creator>Ranhiru</dc:creator>
		<pubDate>Sat, 16 Jan 2010 14:15:10 +0000</pubDate>
		<guid isPermaLink="false">http://themech.net/?p=8#comment-6902</guid>
		<description>This is really interesting!!! Just what i was looking for :D
I was really keen on using ClickOnce but this is much much more easy and neat! I just have to host the XML file somewhere :D

Thanx a lot :) :)</description>
		<content:encoded><![CDATA[<p>This is really interesting!!! Just what i was looking for :D<br />
I was really keen on using ClickOnce but this is much much more easy and neat! I just have to host the XML file somewhere :D</p>
<p>Thanx a lot :) :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: OverTech</title>
		<link>http://themech.net/2008/05/adding-check-for-update-option-in-csharp/comment-page-1/#comment-6736</link>
		<dc:creator>OverTech</dc:creator>
		<pubDate>Wed, 06 Jan 2010 14:51:46 +0000</pubDate>
		<guid isPermaLink="false">http://themech.net/?p=8#comment-6736</guid>
		<description>Great stuff..!  :)

I implemented this in my own application and ran into a small inconvenience.  My users are usually connected to their office on Cisco VPN which blocks most web addresses, including the URL where my XML is located.  XmlTextReader.MoveToContent will return an exception fairly quickly if there is no network connection at all, but if the user is on VPN it takes about 60 seconds before it errors out.

So instead of giving XmlTextReader the URL of the XML file, I created an HttpWebRequest with a modest timeout value then used the GetResponseStream with the XmlTextReader.

# string xmlURL = &quot;http://domain/app_version.xml&quot;;  
# HttpWebRequest hwRequest = (HttpWebRequest)WebRequest.Create(xmlURL);
# hwRequest.Timeout = 5000;
# HttpWebResponse hwResponse = null;
# XmlTextReader reader = null;
# try  
# {  
#  hwResponse = (HttpWebResponse)hwRequest.GetResponse();
#  reader = new XmlTextReader(hwResponse.GetResponseStream());
#  reader.MoveToContent();  
#  ...
# }
# finally
# {
#   if (reader != null) reader.Close();
#   if (hwResponse != null) hwResponse.Close();
# }

Are there any pitfalls with this method that I might be overlooking?

Dave</description>
		<content:encoded><![CDATA[<p>Great stuff..!  :)</p>
<p>I implemented this in my own application and ran into a small inconvenience.  My users are usually connected to their office on Cisco VPN which blocks most web addresses, including the URL where my XML is located.  XmlTextReader.MoveToContent will return an exception fairly quickly if there is no network connection at all, but if the user is on VPN it takes about 60 seconds before it errors out.</p>
<p>So instead of giving XmlTextReader the URL of the XML file, I created an HttpWebRequest with a modest timeout value then used the GetResponseStream with the XmlTextReader.</p>
<p># string xmlURL = &#8220;http://domain/app_version.xml&#8221;;<br />
# HttpWebRequest hwRequest = (HttpWebRequest)WebRequest.Create(xmlURL);<br />
# hwRequest.Timeout = 5000;<br />
# HttpWebResponse hwResponse = null;<br />
# XmlTextReader reader = null;<br />
# try<br />
# {<br />
#  hwResponse = (HttpWebResponse)hwRequest.GetResponse();<br />
#  reader = new XmlTextReader(hwResponse.GetResponseStream());<br />
#  reader.MoveToContent();<br />
#  &#8230;<br />
# }<br />
# finally<br />
# {<br />
#   if (reader != null) reader.Close();<br />
#   if (hwResponse != null) hwResponse.Close();<br />
# }</p>
<p>Are there any pitfalls with this method that I might be overlooking?</p>
<p>Dave</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark</title>
		<link>http://themech.net/2008/05/adding-check-for-update-option-in-csharp/comment-page-1/#comment-6280</link>
		<dc:creator>Mark</dc:creator>
		<pubDate>Wed, 09 Dec 2009 14:05:55 +0000</pubDate>
		<guid isPermaLink="false">http://themech.net/?p=8#comment-6280</guid>
		<description>Very nice example. Clean and straight to the point.</description>
		<content:encoded><![CDATA[<p>Very nice example. Clean and straight to the point.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mech</title>
		<link>http://themech.net/2008/05/adding-check-for-update-option-in-csharp/comment-page-1/#comment-6138</link>
		<dc:creator>mech</dc:creator>
		<pubDate>Fri, 20 Nov 2009 23:11:14 +0000</pubDate>
		<guid isPermaLink="false">http://themech.net/?p=8#comment-6138</guid>
		<description>John,
Thank you for pointing this out, you are absolutely right - the reader should be closed in both cases - when everything is OK and when an exception occurred during parsing. And try...finally is of course the way to do it. I&#039;ve modified the example to follow your good-practice advice :)</description>
		<content:encoded><![CDATA[<p>John,<br />
Thank you for pointing this out, you are absolutely right &#8211; the reader should be closed in both cases &#8211; when everything is OK and when an exception occurred during parsing. And try&#8230;finally is of course the way to do it. I&#8217;ve modified the example to follow your good-practice advice :)</p>
]]></content:encoded>
	</item>
</channel>
</rss>
