Internet Explorer can only make 2 connections at a time, which means that only two elements can be loaded while the rest is queued up. Imaging a web page with 10 Flash movies, then only two of the movies can be loaded at the same time and the rest must wait until there is an available connection open.

That can be a real problem if you want to use the menu to navigate to another page on the website while the Flash movies are loading. Because of the connection pool, you have to wait until you get an available connection before the page is requested. What we want is a way to cancel all the pending requests and make sure we can navigate as fast as possible.

Unfortunately, there is no JavaScript function that will let us cancel requests, so we have to do something else. We can simply tell all the Flash movies not to proceed with the request by setting the movie property to an invalid value. This should be triggered when a link in the menu is clicked.

Put this JavaScript in the <head> section of the document:

<script type="text/javascript">

function CancelFlash()

{

  var elements = document.getElementsByTagName("object");

  if (navigator.appName != "Microsoft Internet Explorer")

    elements = document.getElementsByTagName("embed");

   

  for (i = 0; i < elements.length; i++)

  {

    if (typeof elements[i].IsPlaying() == "boolean")

      elements[i].LoadMovie(0, "notexisting.swf");

  }

}

</script>

Then add the onclick event to all the menu items like so:

>

<a href="products.aspx" onclick="CancelFlash();">Products</a>

It is not common to have many Flash movies embedded on the same web page, but in a recent case there were – a lot of charts – and they all load XML data dynamically created by a HttpHandler. That takes a little bit of time and doubles the HTTP requests made to the server.

The solution is not bullet proof and you have to make sure that the <object> tag has a classid attribute that tells the browser that it is a Flash movie. Then it should be cross-browser compatible.

The build process in ASP.NET 2.0 is very different than in ASP.NET 1.x, because it does not produce a dll file. That means that you cannot use FxCop because it can only work with dll and exe file types. However, there is a way to produce dll files from your web application within Visual Studio 2005 and those dll files can be used by FxCop.

These are the steps to follow to make FxCop analyse your web application:

Step 1

Create a new folder somewhere on the disk. It could be C:\deploy

Step 2

Publish the web application into the new folder

Step 3

Open FxCop and add all the dll files from the newly created bin folder (C:\deploy\bin) to be analyzed.

For those of us not using Visual Studio Team System, these are the steps we need to follow to analyse our web applications in FxCop. Let’s hope the next version of Visual Studio have fixed this issue.