Public Function URLDecrypt(ByVal oKey As String, ByVal oValue As String) As String '*************************************** '***Symmetric Encryption '*************************************** Dim str As String If System.Configuration.ConfigurationSettings.AppSettings.Get("URLEncrypt.Mode").ToUpper = "ON" Then Dim objSym As New FE_SymmetricNamespace.FE_Symmetric 'oValue = System.Web.HttpUtility.UrlDecode(oValue) str = objSym.DecryptData(oKey, System.Text.Encoding.ASCII.GetString(Convert.FromBase64String(Server.UrlDecode(oValue)))) 'str = objSym.DecryptData(oKey, HttpUtility.UrlDecode(oValue, System.Text.Encoding.Default)) Else str = oValue End If Return str End Function Public Function URLEncrypt(ByVal oKey As String, ByVal oValue As String) As String '***Symmetric Encryption '*************************************** Dim str As String If System.Configuration.ConfigurationSettings.AppSettings.Get("URLEncrypt.Mode").ToUpper = "ON" Then Dim objSym As New FE_SymmetricNamespace.FE_Symmetric 'str = objSym.EncryptData(oKey, oValue) ''''''''''''''''''''''''''''''''''''''''''''''''''''' ' convert to base64 before server.urlencode to remove special characters "+" and "==" ''''''''''''''''''''''''''''''''''''''''''''''''''''' str = Server.UrlEncode(Convert.ToByte(System.Text.Encoding.ASCII.GetBytes(objSym.EncryptData(oKey, oValue)))) 'str = HttpUtility.UrlEncode(objSym.EncryptData(oKey, oValue).TrimEnd("=="), System.Text.Encoding.Default) 'str = System.Web.HttpUtility.UrlEncode(str) Else str = oValue End If Return str End Function
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)