Use of the Global. asa file and Chat program

Source: Internet
Author: User
Tags set cookie
Author: scholar
In the previous article, the author gave you a detailed introduction to the use of two very practical ASP built-in objects, Application and Session. Since the OnStart and OnEnd event scripts of both must be declared in the Global. asa file, this article will introduce the usage of the Global. asa file in detail. To help you master the knowledge you have learned so far, this article will also cite an ASP Chat program for your reference.
Recently, many of my friends wrote to me why the previous two sample programs encountered such errors. First of all, I would like to declare to everyone that these procedures are all written by myself. They have passed the qualification test before they are "factory", and there is no "fake or shoddy product ". :) Because cookies are used in the program to record customer information, if you do not set cookie acceptance in the browser, the program will not run properly. In addition, the method used by the program to record customer information on the client cookie is Response. cookie, which must be written before the first <HTML> mark in the ASP file because the Cookie is sent to the customer as part of the HTTP transmission header, if the HTTP header information has been transmitted to the client, then use Response. cookie, the following error will occur: "The HTTP title has been written to the customer's browser. Any HTTP title must be modified before the page content is written .", Some friends may not pay attention when cutting the program, disrupt the order of the program, or mistakenly add the HTML code before the ASP sample program, which leads to program running errors. Therefore, I suggest that you do not make any changes to the program when running the routine for the first time, and try to gradually improve the program on the basis of understanding the program, on the other hand, when running the ASP program, you must select the acceptable Cookie in the browser. Otherwise, once the Cookie or Session is used in the ASP program, they will not run properly.
Next I will introduce how to use the Global. asa file.
What is G lobal. asa file? It is actually an optional file, where programmers can specify event scripts and declare objects with Sessions and application scopes. The content of this file is not used to display to users, but to store event information and objects globally used by applications. The file name must be Global. asa and be stored in the root directory of the application. Each application can have only one G lobal. asa file.
In the Global. asa file, if the included SCRIPT is not encapsulated with the <SCRIPT> Flag, or the defined object does not have a session or application scope, the server returns an error. We can use any language supporting scripts to write scripts contained in the Global. asa file. If multiple events use the same scripting language, they can be organized in a group of <SCRIPT> tags.
The process declared in the Global. asa file can only be called from one or more scripts related to Application_OnStart, Application_OnEnd, Session_OnStart, and Session_OnEnd events. ASP applications are unavailable on ASP pages. If you want to share the process between applications, you can declare the process in a separate file, and then use the server-side inclusion (SSI) statement to include the file in the ASP program that calls the process. Generally, the file name extension must be. inc.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.