There are several ways to send data between pages. In this post I am going to discuss Request.QueryString() and how it can be used to retrieve data from the URL (also known as the QueryString)
This can be a really easy way to set up a dynamic page, however it has its pitfalls. Unless you encrypt the values it is not secure as anyone can see it. The length of the URL is limited, can be obnoxious to type in by hand, and users can change the values.
With that last part in mind test the values before using them. You may even want to encode the values to prevent scripting attacks.
A URL that contains data is going to look like the following:
www.website.com/Default.aspx?variable1=value1&variable2=value2Everything after the question mark is interpreted as data sets. Each pair can be reached by calling the following:
request.querystring("variable2")
No comments:
Post a Comment