-
-
More of a note to self, but this is a brilliant blog post covering a way to decrypt the WebResource.axd parameter string to found out why exactly you are getting a 404 on a WebResource.axd request:
http://blogs.telerik.com/hristodeshev/posts/07-03-26/debugging_asp_net_2_0_web_resources_decrypting_the_url_and_getting_the_resource_name.aspx
And in case that blog dies somewhere in the future, here is the code te decode. Note, this must run in the same website/server as the page where you got the 404.
=======================================
byte[] encryptedData = HttpServerUtility.UrlTokenDecode(urlEncodedData);
Type machineKeySection = typeof(MachineKeySection);
Type[] paramTypes = new Type[] { typeof(bool), typeof(byte[]), typeof(byte[]), typeof(int), typeof(int) };
MethodInfo encryptOrDecryptData = machineKeySection.GetMethod("EncryptOrDecryptData", BindingFlags.Static | 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);
decryptedLabel.BackColor = Color.Lime;
decryptedLabel.Text = decrypted;
}
catch (TargetInvocationException)
{
decryptedLabel.BackColor = Color.Red;
decryptedLabel.Text = "Error decrypting data. Are you running your page on the same server and inside the same application as the web resource URL that was generated?";
}
=======================================