ASP Tutorial Lesson 5: Request

To get information back from a user the data needs to be transmitted from a web form, passed in the web address URL or stored in a cookie. Some information is also provided by the headers which are sent by the browser when making a page request.

TheseĀ approaches are all dealt with by a built-in request object and values can be accessed using

myValue = request(“value”)

This will find a value that matches the name specified. A more robust approach is to use the seperate methods of the request object to prevent naming conflicts.

  • Request.Form for form values submitted using “POST”
  • Request.Querystring for values supplied on the URL or from a form submitted with “GET”
  • Request.Cookies for cookie values
  • Request.Servervariables for information sent in the header or internal server values

For example, take a look at the url of this page and you will see a portion says “?article=96”. Everything after the question mark is the “querystring”. We can access the article value by doing

requestedArticle = request.querystring(“article”)