<?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>Vidar's Musings &#187; http</title>
	<atom:link href="http://www.kongsli.net/nblog/tag/http/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.kongsli.net/nblog</link>
	<description>Deep thoughts on shallow topics</description>
	<lastBuildDate>Tue, 20 Apr 2010 07:45:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Setting HTTP Cache info using ASP.NET</title>
		<link>http://www.kongsli.net/nblog/2009/04/03/setting-http-cache-info-using-aspnet/</link>
		<comments>http://www.kongsli.net/nblog/2009/04/03/setting-http-cache-info-using-aspnet/#comments</comments>
		<pubDate>Fri, 03 Apr 2009 14:24:08 +0000</pubDate>
		<dc:creator>vidarkongsli</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[asp.net]]></category>
		<category><![CDATA[cache]]></category>
		<category><![CDATA[caching]]></category>
		<category><![CDATA[http]]></category>

		<guid isPermaLink="false">http://www.kongsli.net/nblog/2009/04/03/setting-http-cache-info-using-aspnet/</guid>
		<description><![CDATA[Found this nice page that summarizes how to set cache-related information in ASP.NET: ASP.NET Cache Examples and Overview]]></description>
			<content:encoded><![CDATA[<p>Found this nice page that summarizes how to set cache-related information in ASP.NET: <a href="http://dotnetperls.com/Content/Cache-Examples-ASPNET.aspx ">ASP.NET Cache Examples and Overview</a></p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://www.kongsli.net/nblog/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.kongsli.net/nblog/2009/04/03/setting-http-cache-info-using-aspnet/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Internet Explorer automation/Watin: catching navigation error codes</title>
		<link>http://www.kongsli.net/nblog/2008/07/08/internet-explorer-automationwatin-catching-navigation-error-codes/</link>
		<comments>http://www.kongsli.net/nblog/2008/07/08/internet-explorer-automationwatin-catching-navigation-error-codes/#comments</comments>
		<pubDate>Tue, 08 Jul 2008 12:20:02 +0000</pubDate>
		<dc:creator>vidarkongsli</dc:creator>
				<category><![CDATA[Software development]]></category>
		<category><![CDATA[Software testing]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[automation]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[http]]></category>
		<category><![CDATA[internet explorer]]></category>
		<category><![CDATA[internetexplorer]]></category>
		<category><![CDATA[statuscode]]></category>
		<category><![CDATA[watin]]></category>
		<category><![CDATA[web test]]></category>

		<guid isPermaLink="false">http://www.kongsli.net/nblog/?p=64</guid>
		<description><![CDATA[One question have troubled me for some time when automating Internet Explorer (actually, I am doing web testing with Watin): how to test for HTTP status codes. Finally, I figured out how to do this. The lies in an event that the InternetExplorer object raises when navigation is unsuccessful. I ended up with writing a [...]]]></description>
			<content:encoded><![CDATA[<p>One question have troubled me for some time when automating Internet Explorer (actually, I am doing web testing with Watin): how to test for HTTP status codes. Finally, I figured out how to do this. The lies in an event that the InternetExplorer object raises when navigation is unsuccessful.</p>
<p>I ended up with writing a C# helper class:</p>
<pre>using System.Net;</pre>
<pre>using WatiN.Core;</pre>
<pre>using SHDocVw;</pre>
<pre>using Microsoft.VisualStudio.TestTools.UnitTesting;</pre>
<pre>using System.Globalization;</pre>
<pre>namespace Test</pre>
<pre>{</pre>
<pre>    public class NavigationObserver</pre>
<pre>    {</pre>
<pre>        private HttpStatusCode _statusCode;</pre>
<pre>        public NavigationObserver(IE ie)</pre>
<pre>        {</pre>
<pre>            InternetExplorer internetExplorer = (InternetExplorer)ie.InternetExplorer;</pre>
<pre>            internetExplorer.NavigateError += new DWebBrowserEvents2_NavigateErrorEventHandler(IeNavigateError);</pre>
<pre>        }</pre>
<pre>        public void ShouldHave(HttpStatusCode expectedStatusCode)</pre>
<pre>        {</pre>
<pre>            if (!_statusCode.Equals(expectedStatusCode))</pre>
<pre>            {</pre>
<pre>                Assert.Fail(string.Format(CultureInfo.InvariantCulture, "Wrong status code. Expected {0}, but was {1}",</pre>
<pre>                    expectedStatusCode, _statusCode));</pre>
<pre>            }</pre>
<pre>        }</pre>
<pre>        private void IeNavigateError(object pDisp, ref object URL, ref object Frame, ref object StatusCode, ref bool Cancel)</pre>
<pre>        {</pre>
<pre>            _statusCode = (HttpStatusCode)StatusCode;</pre>
<pre>        }</pre>
<pre>    }</pre>
<pre>}</pre>
<p>Note that I use Visual Studio test runner to run my web tests. Then, I can use this in my test:</p>
<pre>using (IE ie = new IE())</pre>
<pre>{</pre>
<pre>    NavigationObserver observer = new NavigationObserver(ie);</pre>
<pre>    ie.GoTo("http://some.where.com");</pre>
<pre>    observer.ShouldHave(HttpStatusCode.NotFound);</pre>
<pre>}</pre>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://www.kongsli.net/nblog/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.kongsli.net/nblog/2008/07/08/internet-explorer-automationwatin-catching-navigation-error-codes/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
