<?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>Just a Coder &#187; Microsoft</title>
	<atom:link href="http://www.nickfitz.co.uk/categories/microsoft/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.nickfitz.co.uk</link>
	<description>The occasional online observations of Nick Fitzsimons</description>
	<lastBuildDate>Sun, 08 Jan 2012 02:09:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.1</generator>
		<item>
		<title>More On ASP.NET&#8217;s Broken Error Handling</title>
		<link>http://www.nickfitz.co.uk/2008/12/10/more-on-aspnets-broken-error-handling/</link>
		<comments>http://www.nickfitz.co.uk/2008/12/10/more-on-aspnets-broken-error-handling/#comments</comments>
		<pubDate>Wed, 10 Dec 2008 18:09:59 +0000</pubDate>
		<dc:creator>nickfitz</dc:creator>
				<category><![CDATA[Bugs]]></category>
		<category><![CDATA[Common sense]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[HTTP]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Web Standards]]></category>

		<guid isPermaLink="false">http://www.nickfitz.co.uk/2008/12/10/more-on-aspnets-broken-error-handling/</guid>
		<description><![CDATA[More on ASP.NET's peculiar approach to HTTP errors.]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve looked a bit more into <a href="http://www.nickfitz.co.uk/2008/12/07/why-cant-microsoft-just-use-http-like-everybody-else/">the way ASP.NET handles HTTP errors</a>, and frankly it now seems not just irritating, but downright bizarre.<br />
<span id="more-33"></span><br />
By the way, although the original post was about a <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5">5xx series server error</a>, this also applies to <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4">4xx series client errors</a>. We&#8217;ll take the familiar <code>404 Not Found</code> as an example case.</p>
<p>Here are the main parts (with some headers and the body omitted) of the response to a broken request for <a href="http://blogs.msdn.com/oldnewthing/default.aspx">Raymond Chen&#8217;s blog</a> &#8211; I deliberately misspelled &#8220;default&#8221; as &#8220;defult&#8221; to trigger a 404:</p>
<p>
<pre><code>
HTTP/1.1 <strong>302 Found</strong>
Date: Wed, 10 Dec 2008 17:46:51 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
CommunityServer: 2.1.61025.2
<strong>Location: /error-notfound.aspx?aspxerrorpath=/oldnewthing/defult.aspx</strong>
Content-Type: text/html; charset=utf-8
Content-Length: 176
</code></pre>
</p>
<p>So, a request for something that is not found returns <code>302 Found</code>. Nice.</p>
<p>What happens when the browser follows the redirection to <code>/error-notfound.aspx?aspxerrorpath=/oldnewthing/defult.aspx</code>? This happens:</p>
<p>
<pre><code>
HTTP/1.1 <strong>404 Not Found</strong>
Date: Wed, 10 Dec 2008 17:46:52 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
CommunityServer: 2.1.61025.2
Content-Type: text/html; charset=utf-8
Content-Length: 11769
</code></pre>
</p>
<p>So, just to get this straight: when something is not found, ASP.NET returns a <code>302 Found</code> response redirecting the client elsewhere. Then, when the redirect is followed, it returns a <code>404 Not Found</code> response, despite the fact that this page clearly <em>has</em> been found, and it was the page that redirected us here that was <em>not</em> found.</p>
<p>Weird. Just plain weird.</p>
<p>Update: an online acquaintance (I don&#8217;t have a URL for him) has pointed me to a page on <cite><abbr title="Microsoft Developer Network">MSDN</abbr></cite> where <a href="http://msdn.microsoft.com/en-us/library/aa479319.aspx">the rationale for this behaviour</a> is presented:</p>
<blockquote cite="http://msdn.microsoft.com/en-us/library/aa479319.aspx"><p>
Redirect creates a new Context, Transfer does not. Redirect requires a round-trip to the browser, Transfer does not. As a result of this round-trip, Redirect rewrites the URL to reflect the location of the error page, Transfer does not.</p>
<p>
If this seems to be an argument in favor of Transfer, it isn&#8217;t. The rationale of the ASP.NET development team is that Redirect <em>accurately displays the URL of the custom error page</em>&#8230;
</p>
</blockquote>
<p>However, at no point is it explained <em>why</em> displaying such an implementation detail to clients is preferable. Given that the article starts with the words:</p>
<blockquote cite="http://msdn.microsoft.com/en-us/library/aa479319.aspx"><p>The quality of a site should be measured not only by how well it works, but by how gracefully it fails.</p>
</blockquote>
<p>it seems strange that it then recommends a technique which causes sites to fail in a singularly graceless manner.</p>
<p>My suggestion would be to modify your ASP.NET application configurations so that the <code>customError</code> capability uses the <code>Transfer</code> technique instead of <code>Redirect</code>. If that </p>
<blockquote><p>&#8230;breaks a tenet of the design philosophy of ASP.NET&#8230;</p>
</blockquote>
<p> then so be it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nickfitz.co.uk/2008/12/10/more-on-aspnets-broken-error-handling/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why &#8220;left: -9999px;&#8221; is Better For Accessibility Than &#8220;display: none;&#8221;</title>
		<link>http://www.nickfitz.co.uk/2007/02/14/why-left-9999px-is-better-for-accessibility-than-display-none/</link>
		<comments>http://www.nickfitz.co.uk/2007/02/14/why-left-9999px-is-better-for-accessibility-than-display-none/#comments</comments>
		<pubDate>Wed, 14 Feb 2007 18:17:20 +0000</pubDate>
		<dc:creator>nickfitz</dc:creator>
				<category><![CDATA[Accessibility]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Internet Explorer]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Web Standards]]></category>

		<guid isPermaLink="false">http://www.nickfitz.co.uk/2007/02/14/why-left-9999px-is-better-for-accessibility-than-display-none/</guid>
		<description><![CDATA[Update: Thierry Koblentz points out in the comments that either technique may be appropriate, depending on circumstances. I mention this in the last paragraph, but just to be clear, there should have been a &#8220;usually&#8221; or &#8220;often&#8221; or some such word in front of the &#8220;better&#8221; of the title. That, or a different title. Update [...]]]></description>
			<content:encoded><![CDATA[<p class="update"><strong>Update:</strong> <a href="http://www.nickfitz.co.uk/2007/02/14/why-left-9999px-is-better-for-accessibility-than-display-none/#comment-21146">Thierry Koblentz points out</a> in the comments that either technique may be appropriate, depending on circumstances. I mention this in the last paragraph, but just to be clear, there should have been a &#8220;usually&#8221; or &#8220;often&#8221; or some such word in front  of the &#8220;better&#8221; of the title. That, or a different title.</p>
<p class="update"><strong>Update 2, December 2008:</strong> It is now accepted that it is better to use <code>top: -9999px;</code>, as using <code>left:</code> would cause a scroll bar on <a href="http://news.bbc.co.uk/hi/arabic/news/">a page with right-to-left text</a>.</p>
<p>A recurring question on various mailing lists such as the <a href="http://webstandardsgroup.org/">Web Standards Group</a> discussion list is &#8220;How can I hide content but still have it accessible?&#8221; This is usually asked in the context of <a href="http://www.access-matters.com/2005/05/08/quiz-114-image-replacement-techniques/">image replacement techniques</a>, where one might for example wish to display a heading in a fancy typeface, but still have the content accessible to users of assistive technologies such as screen reading software.<br />
<span id="more-24"></span><br />
Two techniques, both reliant on CSS, tend to come up in these discussions: hiding the text by the use of <code>display: none</code> or <code>visibility: hidden</code>, and positioning the text off-screen, using absolute positioning and <code>left: -9999px</code>, or <code>margin-left: -9999px</code>.</p>
<p><a href="http://access-matters.com/">Access Matters</a> determined back in June 2005 that the <code>display</code> and <code>visibility</code> techniques appeared to be inaccessible to screen readers, whereas the offscreen positioning method was accessible. The <a href="http://access-matters.com/screen-reader-test-results/">full results</a> go into more detail.</p>
<p>One thing that nobody seemed to have bothered to explain was just <em>why</em> this was the case. Inspired by yet another thread on the subject, I finally decided to do some digging; if I don&#8217;t know <em>why</em> I&#8217;m doing something, I can&#8217;t be sure that I <em>should</em> be doing it, which leads to the risk of <a href="http://catb.org/jargon/html/C/cargo-cult-programming.html">Cargo Cult coding</a>.</p>
<h3>Ask the people who know</h3>
<p>To my astonishment, a search of the <a href="http://msdn.microsoft.com/library">Microsoft Developer Network Library</a> quickly brought me to the explanation I sought. (I was astonished because the MSDN library search is notorious for returning swathes of irrelevant results for even the simplest search; I have heard anecdotal evidence that Microsoft&#8217;s own developers search the library using Google with the <code>site:msdn.microsoft.com</code> specifier.)</p>
<p>The library&#8217;s section on <a href="http://msdn.microsoft.com/library/default.asp?url=/workshop/browser/accessibility/accessibility_node_entry.asp">accessibility support in Internet Explorer</a> is extensive, but the information about <a href="https://msdn.microsoft.com/workshop/browser/accessibility/overview/invisible.asp">invisible objects</a> told me all I needed to know. To quote:</p>
<blockquote cite="https://msdn.microsoft.com/workshop/browser/accessibility/overview/invisible.asp"><p>With Internet Explorer 6 and later, the <code>pvarState</code> parameter of the <code>IAccessible::get_accState</code> property receives <code>STATE_SYSTEM_OFFSCREEN</code> when the object is invisible because of scrolling and receives <code>STATE_SYSTEM_INVISIBLE</code> when the object is invisible because its <code>IHTMLStyle::visibility</code> property is set to <code>hidden</code>, or its <code>IHTMLStyle::display</code> property is set to <code>none</code>.</p></blockquote>
<h3>Again, in English?</h3>
<p>A screen reader doesn&#8217;t load an HTML page: the browser (usually Internet Explorer) does that. What the screen reader does is to ask IE about the content, using an API called <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msaa/msaastart_9w2t.asp">Microsoft Active Accessibility</a> (MSAA). MSAA allows the screen reader to interrogate the browser as to the contents of a page; the dialog, insofar as I understand it, would go something like:</p>
<dl>
<dt>Internet Explorer:</dt>
<dd>Hey, I&#8217;ve just loaded a page.</dd>
<dt>Screen reader:</dt>
<dd>Cool, what&#8217;s it got on it?</dd>
<dt>Internet Explorer:</dt>
<dd>There&#8217;s a heading, then some links, then a few paragraphs.</dd>
<dt>Screen reader:</dt>
<dd>OK; give us the heading.</dd>
<dt>Internet Explorer:</dt>
<dd>It says &#8220;Welcome to HyperGlobalMegaCorp&#8221;.</dd>
<dt>Screen reader:</dt>
<dd>Right, hang on a moment. <em>(Speaks the given text to the user.)</em>  </dd>
</dl>
<p>&#8230; and so on; you get the general idea.</p>
<p>The key is that IE doesn&#8217;t just return content to be spoken in some way; it also returns information <em>about</em> that content. This includes information that goes by the snappy name of <code>pvarState</code>, and one of the aspects of this information is that it can tell the screen reader whether or not the content of the thing it&#8217;s asking about (for example, the heading in the above dialogue) is actually displayed on the screen &#8211; that is, whether it&#8217;s visible or invisible. (Note that these terms aren&#8217;t being used here in exactly the same way as they are in CSS.)</p>
<p>There are three ways that IE comes to regard something as being invisible:</p>
<ol>
<li>It has the CSS property <code>display</code> set to the value <code>none</code>;</li>
<li>It has the CSS property <code>visibility</code> set to the value <code>hidden</code>;</li>
<li>It is in a position where the window would need to be scrolled for it to become visible.</li>
</ol>
<p>IE further distinguishes these three forms of invisibility by dividing them into two kinds. The first two forms of invisibility are denoted by the <code>pvarState</code> value <code>STATE_SYSTEM_INVISIBLE</code>, and the final form is denoted by the value <code>STATE_SYSTEM_OFFSCREEN</code>.</p>
<p>So finally it all becomes clear: screen readers will treat content with the state <code>STATE_SYSTEM_OFFSCREEN</code> as being content that it should read, because it&#8217;s only invisible by virtue of not being within the visible region of the window: after all, a screen reader that required the user to scroll the window to read all of the content would be of very little value to anybody. The only reason that the content can&#8217;t actually be scrolled into view when using the off-left or off-top positioning technique is that Internet Explorer itself doesn&#8217;t support the concept of scrolling the window by a negative amount, although I believe this isn&#8217;t a limitation of the Windows scrolling mechanism <span lang="la">per se</span>.</p>
<p>If, however, the screen reader finds that the state of the content is <code>STATE_SYSTEM_INVISIBLE</code> it apparently concludes that it must have been concealed for a reason, and doesn&#8217;t speak it.</p>
<p>So there you go: use one of the offscreen methods and the screen reader will treat your content as being there; use the <code>display</code> or <code>visibility</code> method and the screen reader will discard it, meaning that this is a reliable way of concealing content from both a normal user and a screen reader user, should you have a reason to do so. But armed with the information above, you&#8217;ll at least know <em>why</em> you&#8217;re using whichever method you apply.</p>
<p class="update">
This post is now available in <a href="http://www.fatcow.com/edu/why-left-9999px-be/">Belorussian</a> provided by <a href="http://www.fatcow.com/">http://www.fatcow.com/</a> &#8211; many thanks for that!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nickfitz.co.uk/2007/02/14/why-left-9999px-is-better-for-accessibility-than-display-none/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>WebDD: Microsoft&#8217;s Reality Distortion Field is Fully Functional</title>
		<link>http://www.nickfitz.co.uk/2007/02/06/webdd-microsofts-reality-distortion-field-is-fully-functional/</link>
		<comments>http://www.nickfitz.co.uk/2007/02/06/webdd-microsofts-reality-distortion-field-is-fully-functional/#comments</comments>
		<pubDate>Tue, 06 Feb 2007 17:10:33 +0000</pubDate>
		<dc:creator>nickfitz</dc:creator>
				<category><![CDATA[Conferences]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Macintosh]]></category>
		<category><![CDATA[Me]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Photography]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[WebDD]]></category>

		<guid isPermaLink="false">http://www.nickfitz.co.uk/2007/02/06/webdd-microsofts-reality-distortion-field-is-fully-functional/</guid>
		<description><![CDATA[A designer? Originally uploaded by writerus drivelus. Last Saturday I went to the WebDD conference at Microsoft Campus, Reading. Following my standard conference procedure, I checked in, obtained coffee, and fired up my MacBook. At this point one of the official photographers (only authorised individuals may take photos at MS) rushed over to me and [...]]]></description>
			<content:encoded><![CDATA[<div class="flickr">
<div class="photo">
 <a href="http://www.flickr.com/photos/43663754@N00/380482052/" title="photo sharing"><img src="http://farm1.static.flickr.com/167/380482052_1a4999424a_m.jpg" alt="A designer?" title="" /></a>
 </div>
<p class="caption">
  <a href="http://www.flickr.com/photos/43663754@N00/380482052/">A designer?</a>
  </p>
<p class="attribution">
  Originally uploaded by <a href="http://www.flickr.com/people/43663754@N00/">writerus drivelus</a>.
 </p>
</div>
<p>
Last Saturday I went to the <a href="http://www.webdd.org.uk/">WebDD</a> conference at <a href="http://www.microsoft.com/uk/about/map-reading.mspx">Microsoft Campus, Reading</a>. Following my standard conference procedure, I checked in, obtained coffee, and fired up my <a href="http://www.apple.com/macbook/">MacBook</a>.
</p>
<p><span id="more-23"></span></p>
<p>
At this point one of the official photographers (only authorised individuals may take photos at MS) rushed over to me and asked, &#8220;Is it all right if I take a photograph of you?&#8221;
</p>
<p>
&#8220;Yeah, fine,&#8221; I replied. As he raised his camera, I asked, &#8220;Is it the Mac?&#8221; &#8220;Yes,&#8221; he said.
</p>
<p>
I&#8217;d only been at Microsoft five minutes, but the Reality Distortion Field had already cast me into a <a href="http://www.hmbateman.com/">Bateman cartoon</a>: &#8220;The Man Who Used a Macintosh on Microsoft Campus.&#8221;
</p>
<p>
(And no, I&#8217;m not a designer.)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nickfitz.co.uk/2007/02/06/webdd-microsofts-reality-distortion-field-is-fully-functional/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

