<?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>I Can Has Code?!? &#187; Multiple Requests</title>
	<atom:link href="http://icanhascode.com/tag/multiple-requests/feed/" rel="self" type="application/rss+xml" />
	<link>http://icanhascode.com</link>
	<description>No, not for you.</description>
	<lastBuildDate>Wed, 17 Jun 2009 07:22:14 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>The Mystery of the Multiple Requests</title>
		<link>http://icanhascode.com/2008/06/the-mystery-of-the-multiple-requests/</link>
		<comments>http://icanhascode.com/2008/06/the-mystery-of-the-multiple-requests/#comments</comments>
		<pubDate>Fri, 20 Jun 2008 05:04:12 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Troubleshooting]]></category>
		<category><![CDATA[Multiple Requests]]></category>

		<guid isPermaLink="false">http://icanhascode.com/?p=5</guid>
		<description><![CDATA[I&#8217;ve ran into this issue for the second time today and it was as much of a pain to troubleshoot it as it was the first time around so I figured I&#8217;d do a little write-up about it so that others may save themselves a good bit of frustration.&#160; 
The first time I encountered the [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve ran into this issue for the second time today and it was as much of a pain to troubleshoot it as it was the first time around so I figured I&#8217;d do a little write-up about it so that others may save themselves a good bit of frustration.&#160; </p>
<p>The first time I encountered the issue, it seemed to happen at random.&#160; I was stepping through some code for the web application I was working on at the time in the debugger and had a breakpoint set that should have only ever been reached once per request and yet this time it was reached twice.&#160; As I was going through some testing, the problem would go away for a time, and then come back, depending on the state of the page.&#160; </p>
<p>Enter the mysterious request&#8230; So instead of trying to troubleshoot any further in the debugger I decided it would be good to look at the requests as they happen using <a href="https://addons.mozilla.org/en-US/firefox/addon/1843">FireBug</a> (or <a href="http://www.fiddlertool.com/fiddler/">Fiddler</a>).&#160; Sure enough, there were two requests anytime I had a certain component visible on the page.&#160; So that narrowed it down further at least in that I knew what component was causing it.&#160; What gave me enough to google on was the fact that the request headers for the 2nd request were different in one very important way, the &quot;Accept&quot; header.&#160; Instead of the usual &quot;text/html&quot; plus friends it was &quot;image/png,image/*&quot; &#8230; which indicates it was a request for an image resource. </p>
<p>Armed with that information, I prayed before the google gods and found a couple of posts (seriously, there were only two that I could find) about the issue and one mentioned an empty &quot;src&quot; attribute on an image tag.&#160; That wasn&#8217;t the case that time, but it got me thinking &#8230; If image tags could do it, what about CSS properties?&#160; Sure enough, that was the problem.&#160; There was one CSS property defined in a style attribute that was &quot;background-image: url();&quot;.&#160; Taking care of the offending property made the issue go away and everyone was happy.</p>
<p>Now, there are a number of things that can cause this situation and they are outlined below.&#160; There are also multiple ways that the issue will show itself in a request log.&#160; </p>
<p> An empty &quot;src&quot; attribute on an image tag.
<pre class="xhtml" name="code">&lt;img src=&quot;&quot; /&gt;</pre>
<p>An emtpy url definition on a CSS property or a url definition with &quot;none&quot;* inside of it. </p>
<pre class="css" name="code">.test {
background: #ffffff url();
background-image: url('');
background-image: url(none);
}</pre>
<p>I&#8217;ll be talking more about the last one in a follow up post. </p>
<p>As for how they can show up in a request log:</p>
<ul>
<li>A second request for the same path and query.&#160; </li>
<li>A second request for the root path (i.e. the normal request is for &quot;/default.aspx&quot; and the second request is for &quot;/&quot;). </li>
<li>A second request for the &quot;none&quot; path (i.e. &quot;/none&quot;). </li>
</ul>
<p>In Firefox the second request will usually always have the &quot;Accept: image/png,image/*&quot; header.&#160; Unfortunately that is not always the case with IE.&#160; IE likes to happily send &quot;Accept: */*&quot; along.</p>
<p>Now how do you go about finding these in your code and markup?&#160; Unfortunately that is not always that easy and you may have to resort to using multiple tools.&#160; A good start is the HTML tab in FireBug.&#160; Another good option is &quot;View -&gt; Source -&gt; DOM&quot; option in the IE Developer Toolbar.&#160; Another thing to do is to search your solution for the offending items.&#160; Searching with regular expressions can be a big help there.</p>
<p>I hope this post proves helpful to someone else that encounters the problem.&#160; It was almost as frustrating to find the culprit the second time as it was the first time and I knew what I was looking for &#8230; though part of that problem was WebForms working against me, but more on that later.</p>
]]></content:encoded>
			<wfw:commentRss>http://icanhascode.com/2008/06/the-mystery-of-the-multiple-requests/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.158 seconds -->
