Webform-Built-in objects

Source: Internet
Author: User

Built-in objects

1.

response--Response Request Object

The response object is used to dynamically respond to client referrals, control the information sent to the user, and dynamically generate responses. The response object only provides a data collection cookie that is used to write cookie values on the client. If the specified cookie does not exist, it is created. If it does exist, it will be updated automatically. The results are returned to the client browser. For: Dynamic response Client instructions, control: sent to the user information.

2.
request--GET Request Object

The purpose of Response.Redirect ("url") is to redirect the server end multiplicity to another Web page.

Response.Write ("hint message"), enter <script>alert (') </script> Pop-up dialog box

3.

session--Relative Global objects

It is very safe and also very easy to use because he is present in memory to read the data fast,

However, no abuse, too many logins can cause the server to crash because of insufficient memory. If you put a big thing like a novel, it takes up a lot of space to waste resources.

Assignment--session["key"] = a value. In another page value: first to determine whether session["key" is not NULL, not the value, otherwise directed to the original page

String a = session["key"];

4.Cockies

Its function is roughly the same as the session, can only save the string, if it is to pass the Chinese character needs decoding, its life cycle is 20 minutes (session).

Decoding method :

String a = Httputility.urlencode (value, System.Text.Encoding.GetEncoding ("Utf-8")); response.cookies["Key"]. Value = A; Response.Redirect ("default2.aspx");//page uploaded to

if (request.cookies["user"]! = null)          decode {String a = Httputility.urldecode (request.cookies["key"]. Value, System.Text.Encoding.GetEncoding ("Utf-8")); Label1.Text = A;}

Persistent cookies, save time by our website code to set, you can set the number of days

response.cookies["User"]. Expires = DateTime.Now.AddDays (7);//Save 7 days.

Exit:

response.cookies["User"]. Expires = DateTime.Now.AddDays (-7);//detection is negative-a few can be, will exit.

Assign the value--response.cookies["user". Value = values;

Value-request.cookies["user"). Value;

5.Application

His life cycle is permanent and exists on the service side.

It is a global object, and the global only one object, as long as it is created, everyone takes the same value,

6.ViewState

As an understanding, but the interview will be the general examination.

The data is saved on the current page.

Like sessions. is session-level. As long as the session does not expire. The data stored in the sessions is in.

ViewState are page-level. As long as this page is stored in. ViewState data.

Webform-Built-in objects

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.