Pass encrypted querystring

You need to download the following files on your project bin folder which will help to generate the encrypted queryString.
TSHAK.Components

after downloading the file you have to change the .doc extension to .dll extension. WordPress does not allow user to upload certain extension of file. If the file does not work after changing the extension, feel free to contact with me.

The main page code for redirect will be the following code:

Byte[] bt = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 8 };
TSHAK.Components.SecureQueryString qs = new TSHAK.Components.SecureQueryString(bt);
qs["Myname"] = "John";
qs["MyAge"] = "5";
qs["textBoxValue"] = this.txtQuery.Text.Trim();
Response.Redirect("QueryString2.aspx?data=" + HttpUtility.UrlEncode(qs.ToString()));

To catch the Querystring you have to use the following code, which will extract the exact value from QueryString


Byte[] bt = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 8 };
        TSHAK.Components.SecureQueryString qs = new TSHAK.Components.SecureQueryString(bt,Request["data"]);

        Response.Write("Orginal :" + Request["data"].ToString());
        Response.Write("");

        Response.Write("My Name" + qs["MyName"].ToString());
        Response.Write("");

        Response.Write("My age" + qs["MyAge"].ToString());
        Response.Write("");
        if (qs["textBoxValue"] != null)
        {
            Response.Write("My Text Box" + qs["textBoxValue"].ToString());
            Response.Write("");
        }

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.