ScriptResources Error : This is an invalid script resource request

Simon Dugré picture Simon Dugré · Nov 1, 2010 · Viewed 28.7k times · Source

We catch this error sporadically. Does anyone know what could it be?

The URL give by our error logging get this weird url for this error :

http://ourWebSite.com/ScriptResource.axd?d=-TlQhVhw2O9j_FRLgdQvFzJxWKYVH6aV62Jse0uO_9PoMsQJaDGiZYtRoBbTATQiWul69JuMDMqOA-yDDycgyNFrGPA_wlnKXZEyWGfJeCg1&t=3717b609

And the error is :

Error : This is an invalid script resource request.

We also get the stacktrace :

System.Web.HttpException: This is an invalid script resource request. at System.Web.Handlers.ScriptResourceHandler.Throw404() at System.Web.Handlers.ScriptResourceHandler.ProcessRequest(HttpContext context) at System.Web.Handlers.ScriptResourceHandler.System.Web.IHttpHandler.ProcessRequest(HttpContext context) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

What could it be? And how can it be solve?

Answer

TheLukeMcCarthy picture TheLukeMcCarthy · Jan 10, 2011

I get this error quite often, doing some research I have found the following.

  1. If you have a web farm your machine keys might not be setup, if this is the case you can resolve the issue by setting the machine key for each server in your web farm. The error can also happen if the machine key changes between post backs which can sometime happen. I believe if you are not using a web farm this is well not happen very often. If you have a web farm this is the most likely cause.
    http://msdn.microsoft.com/en-us/library/ms998288.aspx

  2. It can be caused by spiders, a robots.txt file may help, but only if they are well behaved. A better solution might be to log the IP address of the clients causing the error and if they look like a spider, ban the IP address, be careful not to block legitimate users though.

Sample robots.txt

User-agent: *  
Disallow: /WebSite/ScriptResource.axd  
Disallow: /WebSite/WebResource.axd  

3. The users session timing out will also cause this error.

Hope one of these answers helps

Sources
1) System.Web.HttpException: This is an invalid script resource request
2) http://www.mojoportal.com/Forums/Thread.aspx?pageid=5&mid=34&ItemID=2&thread=4501&pagenumber=1
3) http://www.thestudentroom.co.uk/showthread.php?t=1258531#post25063929