This is a problem that occurs in Internet Explorer serving a Page that contains an image tag that has an empty src attribute. So we have a page like the following aspx page:
Notice that we have an image with a src="" attribute, this causes IE to make another request to defaut.aspx page.
This, though it might sound like a simple harmless problem to some, is a problem when your application is sensitive to any request made to any page. For example, you could be logging every requested page in the session and using this "Navigation Path" to implement site navigation. Note also that this applies when you use an ASP.NET image with an empty ImageURL.
So there you have it, once the reason is known, the mystery is gone.
Update
Thomas Hansen has brought to my attention that IE is not alone when it comes to the way it handles missing resources. Although not exactly the same thing, still Firefox responds by making a request to the same page again, so you get 2 requests to the same page.
<%@ Page Language="C#" AutoEventWireup="true"
CodeFile="Page_With_Missing_Resource.aspx.cs"
Inherits="Page_With_Missing_Resource" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
The following Image is missing:
<br />
<img src="" />
</div>
</form>
</body>
</html>
Notice that we have an image with a src="" attribute, this causes IE to make another request to defaut.aspx page.
This, though it might sound like a simple harmless problem to some, is a problem when your application is sensitive to any request made to any page. For example, you could be logging every requested page in the session and using this "Navigation Path" to implement site navigation. Note also that this applies when you use an ASP.NET image with an empty ImageURL.
So there you have it, once the reason is known, the mystery is gone.
Update
Thomas Hansen has brought to my attention that IE is not alone when it comes to the way it handles missing resources. Although not exactly the same thing, still Firefox responds by making a request to the same page again, so you get 2 requests to the same page.
2 comments:
It's not only IE, all browsers does this...
"It's not only IE, all browsers does this..."
Well, not exactly, what happens int Firefox for example is an additional request to the same page. But thanks for the heads up, I have updated my post accordingly.
Post a Comment