Work and another company docking, adjust the other API needs to use the MD5 encryption, encryption before using Httputility.urlencode, the interface has been returned to verify the error, the location of the problem is found in Chinese encoding using httputility.urlencode caused.
C # httputility.urlencode return URL encoding is lowercase, but the other side is uppercase, MD5 after the hash code is inconsistent, so the Httputility.urlencode method needs to be a layer of encapsulation, the code is as follows:
Public Static stringUrlEncode (stringstr) { stringUrlstr =Httputility.urlencode (str); varUrlcode = Regex.Matches (Urlstr,"%[a-f0-9]{2}", regexoptions.compiled). Cast<match> (). Select (M =m.value). Distinct (); foreach(stringIteminchUrlcode) {Urlstr=urlstr.replace (item, item. ToUpper ()); } returnUrlstr; }
The current idea is this, to be free to optimize it.
C#httputility.urlencode Capitalization issues