title: WebResource.axd error - "This is an invalid webresource request."
body: <p>I have a large .NET 2 web application that has been updated to target the .NET 4.0 framework. Since the update, I am seeing the following error recurring regularly in my logs:</p>
  
  <blockquote>
    <p>This is an invalid webresource
    request.</p>
  </blockquote>
  
  <p>The resource requested is "<strong>~/WebResource.axd</strong>"
  As far as I can tell, the request looks fine in that there's a long querystring with keys (keys are <strong>d</strong>, <strong>t</strong>) and values for those keys.</p>
  
  <p>Has the mechanism for generating requests to WebResource.axd changed between framework versions? Does anyone have any advice about how to go about debugging this issue?</p>
  
  <p><strong>Edit:</strong>
  I found a way to decrypt the web resource request querystring (code follows). The requested resource is <code>pCSSFriendly|CSSFriendly.CSS.Menu.css</code> which looks like an issue with addressing the CSSFriendly.MenuAdapter resource which is used by the application. That leading "p" looks like it could be the problem. </p>
  
  <pre><code>private string DecryptWebResource(string urlEncodedData)
  {
      byte[] encryptedData = HttpServerUtility.UrlTokenDecode(urlEncodedData);
      Type machineKeySection = typeof(MachineKeySection);
      Type[] paramTypes = new Type[] { typeof(bool), typeof(byte[]), typeof(byte[]), typeof(int), typeof(int) };
      System.Reflection.MethodInfo encryptOrDecryptData = machineKeySection.GetMethod("EncryptOrDecryptData", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic, null, paramTypes, null);
  
      try
      {
          byte[] decryptedData = (byte[])encryptOrDecryptData.Invoke(null, new object[] { false, encryptedData, null, 0, encryptedData.Length });
          string decrypted = Encoding.UTF8.GetString(decryptedData);
          return decrypted;
      }
      catch (System.Reflection.TargetInvocationException)
      {
      }
  
      return String.Empty;
  }   
  </code></pre>