views:

72

answers:

1

Hi I am getting the following errors reported by ELMAH on my asp.net mvc 2 site for javascript files, images etc.

System.Web.HttpException: The remote host closed the connection

I have done some research and it appears that the user/bot is clicking a link on the site before the page has fully loaded. Now this error never occurs on a controller action but always on a file that is on disk. e.g.

/Content/CmsImages/logo.png
/Content/CmsImages/MemberImages/Photo-001605.jpg
/Content/jquery.tickertype.js

So this means that all static files are being routed through the mvc pipeline.

What options do I have?

+2  A: 

You could define routes to ignore files in the Content folder.

RouteTable.Routes.IgnoreRoute("{folder}/{*pathInfo}", new { folder="content" });
David Liddle
Thanks for this. Does this handle all files in /content including all sub dirs and files?
Rippo
I believe so as it will ignore anything after /content/*
David Liddle
+1 Thanks for this, have accepted this as answer as it appears to have stopped all errors coming out of this dir
Rippo
@David. Good tip. +1 point
Syd