Built-in Object outline

Source: Internet
Author: User

Built-in objects:
1. Response-Response Request Object
Response.Redirect ("default2.aspx"); redirect
Response.Write ("<script>window.open (' default2.aspx ');</script>");

2. Request-Receives the requested object
request["Key"]-on the right side of the equals sign to take a value
server controls are keyed by ID
A FORM element is a key based on the name value


QueryString-page Address stitching data
such as: default2.aspx?aaa= hehe &bbb= Hey &ccc=hoho

1. Background Response.Redirect ("default2.aspx?key=" + value);
The 2.Form form automatically submits the data via the Submit button, submits the data to the Action Settings page, and method= "get" to submit

Method Submission Methods
Action target page

Get Submit Method

Post Submission Method-Direct Data submission method
In addition to not stitching data in the address bar, no other difference
===================================================================
3. Session
is a temporary object to save the data, saved in the server
Can be understood as containers, variables

You can save the object type, a separate set of connections, a default life cycle of 20 minutes, and reset the 20-minute countdown time if you resubmit the data or refresh the page within 20 minutes.

If there is no content in the session["key", it throws an exception when used, so be sure to determine whether this is empty before using the value of the session.

Note: Do not overuse the session, because put things too big, the user connected more will lead to memory overflow, server crashes, do not use, will cause the waste of resources, because the data in memory is the fastest;

4. Cookies
An object that holds data temporarily, saved in the client
Do not save important information, because it will be deleted by the user at any time, some programs will automatically crawl the user's computer cookie information, if the password is saved in, will be crawled to

Assignment: Using the Response object
1, Response.Cookies.Add (new HttpCookie ("key", value));

2, response.cookies["key"]. Value = values;

3. Make Persistent cookies:
response.cookies["Key"]. Expires = DateTime.Now.AddDays (7);//Setup expires after 7 days

Value: Using the Request object
request.cookies["UserName"]. Value

5, Appliction
An object that holds data temporarily, saved on the server side
Global variables
Everyone is accessing the same object
Assignment value:
application["key"] = value;
Value:
Application.get ("key")

Built-in Object outline

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.