October 16, 2002 - Using the Global Request Object | WebReference

October 16, 2002 - Using the Global Request Object

Yehuda Shiran October 16, 2002
Using the Global Request Object
Tips: October 2002

Yehuda Shiran, Ph.D.
Doc JavaScript

ASP.NET inherited the built-in objects from ASP. These objects are global in the sense that you don't need to construct them or pass them around; they are always there. There are five built-in objects:

Request: Passes information from the user
  • Response: Passes information to the user
  • Server: Controls the IIS Web server
  • Session: Stores and changes information about the user's current Web server session
  • Application:Stores information about the current application. Persistent during the lifetime of the application

    The Request and Response objects include collections as their properties. These are the Request object's collections:

    ClientCertificate: the certificate field issued by the browser. The field names are specified in the x.509 standard
  • QueryString: a free text field
  • Form: the data in an HTML form
  • Cookies: the value of an application-defined cookie
  • ServerVariables: information about the server, such as the server name

    IBuySpy uses the Cookies collection above. When the initial default page (Default.aspx) loads, we check if there is a personalization cookie around, and assemble a personalized Welcome message if there is such a cookie. This is the role of Page_Load():

      function Page_Load(sender: Object , e: EventArgs) : void {
        if (Request.Cookies["IBuySpy_FullName"] != null) {
          WelcomeMsg.Text = "Welcome " + Request.Cookies["IBuySpy_FullName"].Value;
        }
      }