示例#1
0
        public static string EncryptQueryString(string queryStringName, string queryStringValue)
        {
            // prepare encryption of query string
            QueryStringHelper qs = new QueryStringHelper();
            qs.Add(queryStringName, queryStringValue);
            QueryStringHelper qsEncrypted = EncryptionHelper.EncryptQueryString(qs);

            return qsEncrypted.ToString();
        }
示例#2
0
        public static QueryStringHelper FromUrl(string url)
        {
            string[] parts = url.Split("?".ToCharArray());
            QueryStringHelper qs = new QueryStringHelper();
            qs.document = parts[0];

            if (parts.Length == 1)
            return qs;

            string[] keys = parts[1].Split("&".ToCharArray());
            foreach (string key in keys)
            {
            string[] part = key.Split("=".ToCharArray());
            if (part.Length == 1)
                qs.Add(part[0], "");
            else
                qs.Add(part[0], part[1]);
            }

            return qs;
        }
示例#3
0
 /// <summary>
 /// Decrypts a querystring
 /// </summary>
 /// <param name="queryString">encrypted querystring</param>
 /// <returns>a decrypted querystring</returns>
 public static QueryStringHelper DecryptQueryString(QueryStringHelper queryString)
 {
     QueryStringHelper newQueryString = new QueryStringHelper();
     string nm;
     string val;
     foreach (string name in queryString)
     {
         nm = EncryptionHelper.DeHex(name);
         val = EncryptionHelper.DeHex(queryString[name]);
         newQueryString.Add(nm, val);
     }
     return newQueryString;
 }
示例#4
0
 /// <summary>
 /// Encrypts a querystring
 /// </summary>
 /// <param name="queryString">a querystring</param>
 /// <returns>a new encrypted querystring</returns>
 public static QueryStringHelper EncryptQueryString(QueryStringHelper queryString)
 {
     QueryStringHelper newQueryString = new QueryStringHelper();
     string nm = String.Empty;
     string val = String.Empty;
     foreach (string name in queryString)
     {
         nm = name;
         val = queryString[name];
         newQueryString.Add(EncryptionHelper.Hex(nm), EncryptionHelper.Hex(val));
     }
     return newQueryString;
 }
示例#5
0
        /// <summary>
        /// Example code
        /// </summary>
        public static void MyFunction()
        {
            /// Encrypting an url's parameter
            string id = "12";
            // encrypt a value
            string href = "http://www.mypage.se/PrintInvoice.aspx" + EncryptQueryString("id", id);

            // encrypting multiple values
            QueryStringHelper qs = new QueryStringHelper();
            qs.Add("langID", "1");
            qs.Add("prodID", "84");
            QueryStringHelper qsEncrypted = EncryptionHelper.EncryptQueryString(qs);
            string link = "http://www.mypage.se/PrintInvoice.aspx" + qsEncrypted.ToString();

            // decryptng the current url's parameter
            string id1 = DecryptQueryString("id");
            string id2 = DecryptQueryString("langID");
            string id3 = DecryptQueryString("prodID");

            // lower level
            QueryStringHelper qs2 = QueryStringHelper.FromCurrent();
            QueryStringHelper qsdec = EncryptionHelper.DecryptQueryString(qs2);
            // check which site to show, either EventRegistration or MemberValidation Login
            if (qsdec["id"] != null )
            {
                id3 = qsdec["prodID"];
            }
        }
示例#6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //SendOrderMail();
            LoadParameters();
            InitiateMode();

            if (!IsPostBack)
            {
                LoadPriceControls();
                BindRepeaters();

                QueryStringHelper qs = new QueryStringHelper();
                qs.Add("LangID", Master.LanguageID);
                qs.Add("OrderID", orderID);
                QueryStringHelper qsEncrypted = EncryptionHelper.EncryptQueryString(qs);

                PrintHyperLinkImage.NavigateUrl = "~/PrintInvoice.aspx" + qsEncrypted.ToString();
                //PrintHyperLinkImage.NavigateUrl = "~/PrintInvoice.aspx?OrderID=" + orderID + "&LangID=" + Master.LanguageID;
            }
        }