我试图将所有 css 文件合并到一个 css 文件中。
问题在于包含 WebResource.axd 文件。我知道我可以发出一个 http 请求来获取它,但我也知道我应该能够在 AssemblyResourceLoader 中获取它。
url 格式为 WebResource.axd?d=加密标识符&t=时间戳值
我面临的问题是解密加密的标识符,以便我可以检索 css。
有关获取解密标识符或获取页面网络资源内容的替代方法的任何帮助。
谢谢
更新:我发现解密 id 的代码。下一个要解决的问题是访问资源中的内容。这是解密代码
public string DecryptWebResourceIdentifier(string urlEncodedData)
{
byte[] encryptedData = HttpServerUtility.UrlTokenDecode(urlEncodedData);
string decrypted="";
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 });
decrypted = Encoding.UTF8.GetString(decryptedData);
}
catch
{
}
return decrypted;
}