System.Web.HttpException: This is an invalid script resource request

后端 未结 5 1410
忘掉有多难
忘掉有多难 2021-02-01 10:30

I get this error when pushing our website to our clients production server however the page works absolutely fine on their dev / test servers. What causes this error (consideri

相关标签:
5条回答
  • 2021-02-01 10:50

    The error in the end was due to some URL re-writing that was occuring the server to which the admins hadn't told us about.! Watch out for that one

    0 讨论(0)
  • 2021-02-01 11:05

    I used to get this annoying error all the time. Users are indeed affected by this error. We used to get complaints of pages not loading properly. After trying many things like adding DOCTYPE the error did not go away completely. Then we tried storing all the VIEWSTATEin session. Violà no more errors. If your application has a bloated view state like ours then you will see this error in the logs. Often.

    0 讨论(0)
  • 2021-02-01 11:08

    Can you get a full stack trace on this error? There will be one in the server event log (system or application, can't remember which)?

    There are various parts of ASP.NET that use script resources, and at least two slightly obscure causes of them failing with this sort of error I can think of.

    1. believe it or not, if your dlls have embedded resources in them, and they are dated in the future this will happen (if you ever compile dlls in the UK and then immediately deploy them to US web servers you'll be well aware of this issue!). I can't remember the event log error this shows, but would know if I saw it - and it is not immediately obvious.
    2. if you have a load balancer routing requests between multiple servers without being "sticky", and your servers have different machine keys, then the request will fail because the encrypted querystring identifying the resource will not be decryptable on another server. This will cause a stack trace that includes various crypto types in it.

    There are lots of other causes (such as incorrect uris, or querystrings getting corrupted as mentioned above), but having a full stack trace will help here.

    0 讨论(0)
  • 2021-02-01 11:10

    If indeed you are using multiple servers try the following: Add to your web.config:

    <machineKey  
    validationKey="21F090935F6E49C2C797F69BBAAD8402ABD2EE0B667A8B44EA7DD4374267A75D7
                   AD972A119482D15A4127461DB1DC347C1A63AE5F1CCFAACFF1B72A7F0A281B"           
    decryptionKey="ABAA84D7EC4BB56D75D217CECFFB9628809BDB8BF91CFCD64568A145BE59719F"
    validation="SHA1"
    decryption="AES"
    />
    

    But generate the validationKey and decryptionKey yourself using the code examples found here: http://msdn.microsoft.com/en-us/library/ms998288.aspx The above link also explains more about this solution so check it out, look for Web Farm Deployment Considerations on that page

    0 讨论(0)
  • 2021-02-01 11:11

    You can check the urls which were generating this error. Web resources (used by the Ajax Toolkit) rely on a query string argument. If that argument is altered in some way (perhaps by some malicious user) the HTTP handler will throw exception that it cannot find the requested web resource.

    0 讨论(0)
提交回复
热议问题