Intimate contact with asp.net (cookies)

Source: Internet
Author: User
Tags new features

Cookies

Cookies are also used in the same ways as the ASP. For example, we set up a cookie named ASPCN, a flying knife.

HttpCookie cookie = new httpcookie["ASPCN"];
Cookie. Value = "flying Knife";
Response.appendcookie (cookie);

It's also easy for us to remove the cookie value.

HttpCookie cookie = request.cookies["ASPCN"];
Cookievalue = cookie. Value;

Sometimes we want to store multiple messages in a cookie, and that's fine. For example, we add more information under a cookie named ASPCN.

HttpCookie cookie = new HttpCookie ("ASPCN");
Cookie. Values.add ("webmaster", "flying Knife");
Cookie. Values.add ("writer", "Beige");
Cookie. Values.add ("LinkColor", "Blue");
Response.appendcookie (cookie);

Removing information is as simple as

HttpCookie cookie = request.cookies["ASPCN"];
value1 = cookies. values["Webmaster"];
value2 = cookies. values["Writer"];

View State

This is a new thing, with the same usage and session, his main purpose is to record the state of Web control. Although it is new, but and application, the use of the session is no different, so do not want to explain in detail.

state["Droploadindex"] = 0;

Basic usage as above: But keep in mind that the information he has in existence can only be used in an ASPX file. After going out, this is no use, because his purpose is to save the state of the Web control.

Asp. NET Advanced Applications

Asp. NET of the basic part, we have explained, but this is not the end of the ASP.net function, there are many asp.net new features powerful AH.

Web Service
Track
Internationalization
Cache
Making components
Workpiece controls

There are a lot of ah, oh, I can not speak at one breath, our next topic is "ASP." NET Advanced Application Step series. "Intimate contact asp.net" mainly talk about the basis, hehe, I have finished:



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.