ASP built-in objects-request, Response, Server, application, objectcontent (i)

Source: Internet
Author: User
Tags html form
<span id="Label3"></p><p><p><span style="font-size:24px">ASP provides built-in objects that can be used in scripts, making it easier for users to gather information sent through browser requests, respond to browsers, and store user information, simplifying the work of Developers.</span></p></p><p><p><span style="font-size:24px">Common built-in Objects Are:</span></p></p> <ul type="disc"> <ul type="disc"> <li>the <span style="font-size:24px">request object, which is used to access any information that is passed using an HTTP Request. </span></li> <li><span style="font-size:24px">a Response object that controls the information sent to the Browser. </span></li> <li>The server <span style="font-size:24px">object that is used to access methods and properties on the Server. </span></li> <li><span style="font-size:24px">a Application object that is used to share application Information. </span></li> <li><span style="font-size:24px">A Objectcontent object that controls ASP script initialization Transactions.</span></li> </ul> </ul><p><p><span style="font-size:24px"><span style="white-space:pre"></span>Each built-in object has its own properties, methods, collections (Collection), or Events (event). Properties are used to describe the attributes of built-in objects, which are used to perform actions on built-in objects, which are containers that contain specific data, and events are specific actions that occur in certain situations.</span></p></p><p><p><span style="font-size:24px"><br></span></p></p><p style="color:#17365D"><p style="color:#17365D"><span style="font-size:24px">Request Object</span></p></p><p style="color:#17365D"><p style="color:#17365D"><span style="font-size:24px"><br></span></p></p><p><p><span style="font-size:24px"><span style="white-space:pre"></span>The request object, which is used during HTTP requests to access information that is passed to the server by any client browser, including parameter information passed through the url, HTML form data passed using the Get method or post method, cookies and user authentication information, and so On.</span></p></p><p><p><span style="font-size:24px">The syntax format for the Request object is as Follows:</span></p></p><p><p><span style="background:yellow"><span style="font-size:24px">request[.collection|property|method] (variable)</span></span></p></p><p><p><span style="font-size:24px">The syntax is described as Follows:</span></p></p> <ul type="square"> <ul type="square"> <li><span style="font-size:24px">A collection that is a collection member of the Object. The request object mainly includes the Following:</span> <ul type="circle"> <li><span style="font-size:24px">ClientCertificate collection to get validation field Information. </span></li> <li><span style="font-size:24px">cookies collection to obtain cookie Data. </span></li> <li>the <span style="font-size:24px">QueryString collection that gets the parameters that the client has appended to the URL address. </span></li> <li><span style="font-size:24px">A form collection that gets the information that the client entered in the form form. (form Method Property value is Post)</span></li> <li><span style="font-size:24px">The ServerVariables collection, which gets the Server-side environment variables and header information from the HTTP request messages sent by the Client.</span></li> </ul></li> </ul> </ul> <ul type="square"> <ul type="square"> <li><span style="font-size:24px">property, the attribute member of the Object. The request object includes one of the following properties:</span> <ul type="circle"> <li>the <span style="font-size:24px">TotalBytes property that gets the total number of bytes Sent. </span></li> </ul></li> </ul> </ul> <ul type="square"> <ul type="square"> <li><span style="font-size:24px">method, an Object's methods Member. The request object includes one of the following methods:</span> <ul type="circle"> <li><span style="font-size:24px">the BinaryRead method, which reads data in binary Mode. </span></li> </ul></li> </ul> </ul> <ul type="square"> <ul type="square"> <li><span style="font-size:24px">variable, the member variable of the Object.</span></li> </ul> </ul><p><p><span style="font-size:24px"></span></p></p><p style="color:#366092"><p style="color:#366092"><span style="font-size:24px">Read cookie Data</span></p></p><p><p><span style="font-size:24px"></span></p></p><p><p><span style="font-size:24px"><span style="white-space:pre"></span>A cookie is a tag in a Web site used to record data that a user has entered on a Website. The use of cookies can effectively reduce the number of user input data, simplifying user Operations. The Cookies collection allows the user to read all the cookie data sent in the HTTP Request. The syntax format for the cookie collection is as Follows:</span></p></p><p><p><span style="background:yellow"><span style="font-size:24px">Request.Cookies (cookie) [(key) |. Attribute</span></span></p></p><p><p><span style="font-size:24px">Parameter description:</span></p></p> <ul type="square"> <ul type="square"> <li><span style="font-size:24px">A cookie that specifies the name of the Cookie.</span></li> </ul> </ul> <ul type="square"> <ul type="square"> <li><span style="font-size:24px">key, which specifies the keyword name of the cookie, is distinguished from the keyword using the same name as the Cookie.</span></li> </ul> </ul> <ul type="square"> <ul type="square"> <li><span style="font-size:24px">Attribute,cookie properties, The following properties are Desirable:</span> <ul type="circle"> <li><span style="font-size:24px">domain, which specifies the domains that can read the Cookie. </span></li> </ul> <ul type="circle"> <li><span style="font-size:24px">Expires, Specify the expiry time of the Cookie. </span></li> </ul> <ul type="circle"> <li><span style="font-size:24px">haskeys, Specifies whether the cookie contains KEYWORDS. </span></li> <li>path <span style="font-size:24px">, which specifies where to read the Cookie. </span></li> <li>secure <span style="font-size:24px">to specify whether the cookie is Secure. </span></li> </ul></li> </ul> </ul><p><p><span style="font-size:24px">Read cookies</span></p></p><p><p><span style="font-size:24px"></span></p></p><pre name="code" class="csharp"><pre name="code" class="csharp">If (request.cookies["username"]!=null) { string username =request.cookies["username"]. Value;} If (Request. Cookies ["logininfo"]!=null) { String Username=request. cookies["logininfo" ["username"]; String Password =request.cookies["logininfo" ["password"];}</pre></pre><br><p><p></p></p><p style="color:#366092"><p style="color:#366092"><span style="font-size:24px">Reading the data passed by the form</span></p></p><p><p><span style="font-size:24px"></span></p></p><p><p><span style="font-size:24px"><span style="white-space:pre"></span>Users can submit data through a table-to-server, which can contain elements such as text, text boxes, check boxes, radio buttons, buttons, text areas, and so On. There are two methods of get and post for the form submission Server. When submitting data by using the post method, you must use the form collection to retrieve the form data sent in the HTTP Request.</span></p></p><p><p><span style="font-size:24px">Syntax format for the form collection:</span></p></p><p><p><span style="background:yellow"><span style="font-size:24px">Request.Form (parameter) [(index) |. Attribute</span></span></p></p><p><p><span style="font-size:24px">Parameter description:</span></p></p> <ul type="square"> <ul type="square"> <li><span style="font-size:24px">parameter, Specifies the name of the form to Read.</span></li> </ul> </ul> <ul type="square"> <ul type="square"> <li><span style="font-size:24px">index, to read the indexes of the Parameters. </span></li> <li><span style="font-size:24px">attribute, parameter attribute (count, number of arguments).</span></li> </ul> </ul><p><p><span style="font-size:24px">In the following example, add a new reader:</span></p></p><p><p><span style="font-size:24px">Addreader.aspx</span></p></p><p><p><span style="font-size:24px"></span></p></p><pre name="code" class="html"><pre name="code" class="html"><formmethod= "post" name= "faddreader" class= "contact" id = "faddreader" >
Related Article

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.