Asp.net pre-exam review-Status Management

Source: Internet
Author: User

ApplicationStatus Management

Application ["Number"] = 0;

Application ["Number"] = (INT) application ["Number"] + 1;

 

 

 

SessionStatus Management

 This. label2.text = session ["who"]. tostring ();

 Session ["who"] = This. textbox1.text; 

 

Application And Session Differences: Application Pass the data that applies to all pages, Session Transmits data suitable for a specific connection.

 

 

Status information is stored outside the process

1), Saved on the Status Server 

<Sessionstate mode = "StateServer"Stateconnectionstring = "TCPIP = 127.0.0.1: 42424"Cookieless = "false"
Timeout = "20"/>

</Sessionstate>

 2), Stored in the database

<Sessionstate mode = "sqlserver"
Sqlconnectionstring = "Data Source = (local); User ID = sa; Password ="/>

 

 

Cookie 

//DefinitionCookie, Set its value

Httpcookie objcookie = new
Httpcookie ("mycookie ");

Objcookie. Values. Add ("backcolor ",
"Blue ");

Objcookie. expires =
Datetime. Now. addhours (1 );

Response. Cookies. Add (objcookie );

 

//UseCookie

Httpcookie objcookie =
Request. Cookies ["mycookie"];

Button1.backcolor = system. Drawing. color. fromname (objcookie. Values ["backcolor"]); 

 

 

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.