Solutions to session loss during ASP. NET development (learning test)

Source: Internet
Author: User

There are many methods to pass values on ASP. NET pages, but each has its own advantages and disadvantages.

1. Cookies are easy to use, but not everyone's computer will use them for you.

2. Application is also good, but it is global. When you move your toes down, you will know that it is less pitiful to use it.

3. querystring is okay, that is, it has too many limitations. Simple IDS can be used for other things, and I don't want to use them if it's a little complicated.

4. server. Transfer is good, but it is a little troublesome to understand.

5. Today's topic session

 

Sessions in ASP. NET are easily lost when the system is busy. How can we solve this problem? We can find two solutions by looking at some materials.

Method 1: store the session directly to the database (of course, SQL Server), in c: \ windows \ Microsoft. the net \ framework \ v2.0.50727 directory contains installsqlstate. SQL file, run it directly, generate the SQL State database, and set the session. This method has the advantages of security, but the speed will be lower.

Method 2: Save the session in another process, namely StateServer. You need to modify the Windows registry, port number, and Web. config. if the process is accidentally terminated, the session is also lost, so it is not the safest, but the speed is slightly higher than that of the database.

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.