Exemplo n.º 1
0
        public static string encriptacadena(string cadenaaencriptar)
        {
            CCryptorEngine cryp = new CCryptorEngine();

            byte[] bytesencriptados = cryp.Encriptar(cadenaaencriptar);
            string ax;

            ax = HttpServerUtility.UrlTokenEncode(bytesencriptados);
            return(ax);
        }
Exemplo n.º 2
0
        public static bool loadqueryStrings(String cadenaadividir, ref Hashtable myQueryStrings)
        {
            try
            {
                byte[]         bytesadesencriptar = HttpServerUtility.UrlTokenDecode(cadenaadividir);
                CCryptorEngine cryp = new CCryptorEngine();
                cadenaadividir = cryp.Desencriptar(bytesadesencriptar);

                if (cadenaadividir != null)
                {
                    string[] elementosdehash = cadenaadividir.Split('&');

                    foreach (string elementodehash in elementosdehash)
                    {
                        if (elementodehash != null && elementodehash.Length > 0)
                        {
                            string[] valores = elementodehash.Split('=');
                            if (valores.Length == 2 && valores[0].ToString().Length > 0 && valores[1].ToString().Length > 0)
                            {
                                String par1 = valores[0].ToString();
                                String par2 = valores[1].ToString();

                                myQueryStrings.Add(par1, par2);
                            }
                            else
                            {
                                return(false);
                            }
                        }
                    }
                }
                else
                {
                    myQueryStrings.Clear();
                    return(false);
                }
            }
            catch (Exception exception)
            {
                return(false);
            }
            return(true);
        }