Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What's the use of ASP.NET 's Session State?

2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article introduces the relevant knowledge of "what is the use of ASP.NET Session State?". In the operation of actual cases, many people will encounter such a dilemma. Next, let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

For this reason, the users of ASP have to manually synchronize the session information to the external database with the session ID as the primary key, in order to alleviate similar problems.

In ASP.NET, because these problems are taken into account in design, these limitations can be avoided: 1. Support out-of-process state management, manage session state 2. 5 through independent state management service or SQL Server state server. State maintenance without Cookie is supported, and the use of Cookie 3. 0 is avoided by automatically adding session ID in URL. Using session information synchronously when load balancing is supported by independent state management service or SQL Server state server is implemented by four different state managers selected according to the mode attribute of the Session State tag in the Session StateModule.InitModuleFromConfig function mentioned in the previous section.

The following is the program code:

Session management is prohibited in Off mode, while ASP.NET also allows program code by fine-grained management of the session support status of the page with the Enable Session State attribute:

InProc mode is compatible with the previous ASP strategy and implements memory-based session state management in the same process space of ASP.NET, which is the fastest but subject to the same restrictions as ASP. STATE SERVER mode responds to session state services with IP and ports specified by stateConnectionString through ASP.NET State Service service (aspnet_state.exe) installed independently by ASP.NET. SQLServer mode maintains session state with in-memory temporary tables (built with InstallSqlState.sql, using tempdb in-memory database) or independent tables (monitored by InstallPersistSqlState.sql, using independent ASPState libraries) through the SQLServer server specified by sqlConnectionString.

The relative values of these four different state managers are as follows: Table 4-1: Normalized TTLB (Time to Last Byte) bySession State Mode (in Milliseconds per 100Requests)

CONCURRENT BROWSERS MODE = OFF MODE = INPROC MODE = STATE SERVER MODE = SQLSERVER 1 7.81 4.54 8.27 8.47 5 28.28 20.25 27.25 29.29 10 89.38 46.29 77.29 85.11 Table 4-2: Average Requests per Second bySession State Mode CONCURRENT BROWSERS MODE = INPROC MODE = SQLSERVER 1 18.86 24.17 18.31 18.11 21.66 25.74 21.34 10 17.23 23.8 18.11 17.6 The performance of the out-of-process state manager is acceptable, both in terms of TTLB and the average number of requests per second, and of course needs to be optimized when writing code for state management situations. However, to use the out-of-process state manager, objects saved in the session are limited by the need to improve binary serialization support.

From a usage point of view, state managers are actually managed by the HttpSessionModule mentioned in the previous section and accessed through the HttpSession State interface.

This is the end of the content of "what is the use of ASP.NET 's Session State"? thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report