我在我的應用程序中實現了RC4加密/解密,如下所示。 在行異常結束時到來。asp.net中的RC4加密/解密問題
string sFNToBase64String = Convert.ToBase64String(Encoding.ASCII.GetBytes("Malhotra"));
string sEnFirstName = CommonFunction.RC4EncryptDecrypt(sKey, sFNToBase64String);
//calling webservice
localhost.LoginRequest objRQ = new localhost.LoginRequest();
string sIsValidate = objRQ.ValidateRequest(sEnFirstName); //Exception coming on this line
異常來
//Exception coming
The request failed with HTTP status 400: Bad Request.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Net.WebException: The request failed with HTTP status 400: Bad Request.
我們怎樣才能解決這個問題。
----------- UPDATE -------------------
其實問題只與加密文本「馬爾霍特拉」[加密文本:CX±£lê$ $]。 我認爲有一些特殊字符是Web服務調用不允許的。
我們該如何處理這個問題?
----------------------- Encrypted/Decrypted Process ------------------ ---
//Encrypte
string sEnLastName = CommonFunction.RC4EncryptDecrypt(sKey, "Malhotra");
//Encode
string sLNToBase64String = Convert.ToBase64String(Encoding.ASCII.GetBytes(sEnLastName));
//Decode
string sDecodeLastName = Encoding.ASCII.GetString(Convert.FromBase64String(sLNToBase64String));
//Decrypte
string sDeLastName = CommonFunction.RC4EncryptDecrypt(sKey, sDecodeLastName);
哪一行發生異常? – Jaymz 2011-04-04 08:22:06
string sIsValidate = objRQ.ValidateRequest(sEnFirstName); – Sukhjeevan 2011-04-04 09:12:47
PLZ查看更新後的問題。 – Sukhjeevan 2011-04-04 09:42:50