We see so many encrypted pages with tight security features around the internet. Do you want to make an encrypted page for yourself? What if we start from the basics and encrypt a query inside and ASP page? So let me show you how.

To encrypt a query string we will need to pass it an encryption key which is a byte array


Dim qs As TSHAK.Components.SecureQueryString
qs = New TSHAK.Components.SecureQueryString(New Byte() {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 8})

To add the query string values

qs("Myname")="John"
qs("MyAge")=5
Response.Redirect("Page2.aspx?data=" + HttpUtility.UrlEncode(qs.ToString()))

Now to decrypt and use the values in Page2.aspx

Dim qs As TSHAK.Components.SecureQueryString
qs= New TSHAK.Components.SecureQueryString(New Byte() {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 8}, Request("data"))
Dim myName=qs("MyName")
Dim age=qs("MyAge")

[Source: tutorialsasp.net]