18

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?

Kiquenet
  • 14,494
  • 35
  • 148
  • 243
Simon Dugré
  • 17,980
  • 11
  • 57
  • 73

2 Answers2

30

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

Community
  • 1
  • 1
TheLukeMcCarthy
  • 2,253
  • 2
  • 25
  • 34
  • Here's a resource I found useful: http://blogs.telerik.com/aspnet-ajax/posts/07-03-27/debugging-asp-net-2-0-web-resources-decrypting-the-url-and-getting-the-resource-name.aspx. There is a link to a standalone page near the end of the article. You add it to your project and click "browse with..." in Visual Studio. You paste the d=... query string and it tells you to what the query string refers. – MrBoJangles Feb 04 '14 at 22:41
3

You may be using AJAX. ScriptResource.axd is a handler meant to serve your scripts that are in turn stored inside your assembly.

http://forums.asp.net/t/1258715.aspx

The URL isn't weird if you think about it. It has two parameters d and t. Can you reproduce this error at will?

Rahul Soni
  • 4,941
  • 3
  • 35
  • 58
  • 1
    We are not able to determine exactly why or even where it occurs. We have in any case never managed to recreate the problem. It seems that it happens sporadically. Fortunately, this does not occur more than once or twice for all the sites we have a day. But we'd like to know the reason ... – Simon Dugré Nov 01 '10 at 13:47
  • Yeah ok, maybe its AJAX as you said but, "we" do not use AJAX in our site exept a Compoment we've bought from a trust compagny. But is there anything we can do to stop receive this error? – Simon Dugré Nov 01 '10 at 15:00
  • 1
    Normally, 404 means a resource is not found. Now, this can be a liar message, simply because if there are file types blocked on your server or URL Scan is installed it would block it every time. Since you said that it happens only once in a while, to troubleshoot it, you should take a look at your IIS Logs and figure out what is the error code along with 404. http://support.microsoft.com/kb/943891. Notice the code after 404. Check the KB article for more. 404.6 for instance will be verb denied! – Rahul Soni Nov 01 '10 at 16:30
  • We'll check with our web hoster so maybe we could try to find a solution. Thank you Rahul... but I still can figure out why it happens "sometime"... – Simon Dugré Nov 01 '10 at 17:11