ASP   «Prev 

How an ASP page responds to a browser Request

An Active Server Pages (ASP) page responds to a browser request through a process that involves several key steps:

  1. Request Received: When a user enters a URL into a browser, a request is sent to the server hosting the website. If the URL refers to an ASP file, the server recognizes it as a call to an ASP page.
  2. ASP Engine Activation: The server then routes this request to the ASP engine. This is because an ASP file is different from a regular HTML file. It can contain scripts written in VBScript or JavaScript, which need to be processed before sending a response to the client.
  3. Script Execution: The ASP engine reads through the ASP file line by line, executing any script code that it encounters. The script is run on the server side, meaning it can perform complex operations such as accessing databases, interacting with server-side resources, or performing computations based on user input. This is the key feature of ASP and what makes it a powerful tool for dynamic web page creation.
  4. HTML Generation: Any text not contained within script delimiters is treated as plain HTML. The ASP engine will combine the output of the script execution with this HTML to produce a complete HTML file. This allows the ASP page to generate a custom HTML page in response to each request.
  5. Response Sent: The server sends this generated HTML file back to the client's browser. Since the browser only receives HTML, and not the underlying ASP code, the response can be read and rendered by any browser, regardless of the client's operating system or other specifications.
  6. Browser Rendering: Upon receiving the HTML response from the server, the browser then renders the HTML to produce the visible webpage. This can include text, images, links, and other elements typical of web pages. The client's browser does not need to understand or interpret any ASP code, as all of this is handled server-side.

This process allows ASP to produce dynamic, custom web pages in response to user requests. It's important to remember that each time a user requests an ASP page, this process repeats, meaning the page is generated afresh with each request. This ensures the most up-to-date data is used when generating the page.
The following code example sends a list of the browser's capabilities back to the client in an HTML page.

HttpBrowserCapabilities bc = Request.Browser;
Response.Write("Browser Capabilities:);
Response.Write("Type = " + bc.Type);
Response.Write("Name = " + bc.Browser);
Response.Write("Version = " + bc.Version);
Response.Write("Major Version = " + bc.MajorVersion);
Response.Write("Minor Version = " + bc.MinorVersion);
Response.Write("Platform = " + bc.Platform);
Response.Write("Is Beta = " + bc.Beta);
Response.Write("Is Crawler = " + bc.Crawler);
Response.Write("Is AOL = " + bc.AOL);
Response.Write("Is Win16 = " + bc.Win16);
Response.Write("Is Win32 = " + bc.Win32);
Response.Write("Supports Frames = " + bc.Frames);
Response.Write("Supports Tables = " + bc.Tables);
Response.Write("Supports Cookies = " + bc.Cookies);
Response.Write("Supports VB Script = " + bc.VBScript);
Response.Write("Supports JavaScript = " + bc.JavaScript);
Response.Write("Supports Java Applets = " + bc.JavaApplets);
Response.Write("Supports ActiveX Controls = " + bc.ActiveXControls);
Response.Write("CDF = " + bc.CDF);