The article How to hide URL query information in ASP.NET in VB.NET describes a class named EncryptedQueryString which is used in the next example to illustrate how you can use it in your projects. You have to build two web pages:

– The first one (QueryStringSender) can contain a text box for entering information and a button which is used to send the encrypted query string to the receiving page.

– The second one (QueryStringReceiver) deserializes the query string passed in through the data query string parameter





<form id=”Page 1″ runat=”server”>


Enter some data here: <asp:TextBox runat=”server” ID=”MyData” />

<br />

<br />

<asp:Button ID=”SendCommand” runat=”server” Text=”Send Info” OnClick=”SendCommand_Click” />




When the user clicks the SendCommand button, the page sends the encrypted query string to the receiving page, as follows:


Protected Sub SendCommand_Click(sender As Object, e As EventArgs)

Dim QueryString As New EncryptedQueryString()

QueryString.Add(“MyData”, MyData.Text)

QueryString.Add(“MyTime”, DateTime.Now.ToLongTimeString())

QueryString.Add(“MyDate”, DateTime.Now.ToLongDateString())

Response.Redirect(“QueryStringReceiver.aspx?data=” &     QueryString.ToString())

End Sub



<form id=”Page 2″ runat=”server”>


<h2>Information retrieved:</h2>

<asp:Label runat=”server” ID=”QueryStringLabel” />




Protected Sub Page_Load(sender As Object, e As EventArgs)

‘ Deserialize the encrypted query string

Dim QueryString As New EncryptedQueryString(Request.QueryString(“data”))


‘ Write information to the screen

Dim Info As New StringBuilder()

For Each key As [String] In QueryString.Keys

Info.AppendFormat(“{0} = {1}<br>”, key, QueryString(key))


QueryStringLabel.Text = Info.ToString()

End Sub