[Repost] ASP.NET Lecture (6) -ASP.NET Several main files

xiaoxiao2021-03-06  20

Tongren using ASP must often use these things, because no matter what product is inseparable from the interaction with users, and in ASP, they are three bridges that are interactive.

ASP.NET, they also received enough attention, but the change is not very big.

6.1 Application

Application lifecycle

The life cycle of Application is not starting from the moment that IIS5 starts, but starts from the customer to the first Request to the server. Since then, a Pool called HTTPApplication is beginning to build, which is also the beginning of the Application Lifecycle (Lifetime). At this time, the event of Application_onstart has also happened. Until Application_ONEND event occurs, is the end of the Application lifecycle.

Application Writing Website Counter

<% Application.lock () Application ("counter") = ctype (Application ("counter") 1, int32) Application.unlock ()%>

Still the same as the ASP.

Application and ASP different places

Application and ASP Different parts of the new event Application_ONREQUESTART () and Application_ONREQUESTEND (), which starts to browse an ASPX file, and trigger at the end of the ASPX file, that is, these two events, Not for the entire server, but for a single program.

6.2 session

In ASP, we all know that if the user turns off the cookies above the browser, the session is impossible to pass, and the ASP.NET is for this issue, and the transmission of the session should be detached from cookies. We modified config.Web and remember this file? The essence of the non-mounting program transplantation of ASP.NET is in such a file.

Modify the following: Change to TRUE can have no difference in session and ASP.

6.3 cookies

Here and the ASP have some differences.

Create a cookies

Dim cookie as new httpcookie ("user") cookie.value = "yesky.com" response.AppendCookie (cookie) reads a cookiesdim cookie as new httpcookie ("user") strcookie = cookie.Value

6.4 State

This is a brand new thing that saves the intermediate process volume on the browser. For example, to register a new user, we often fill in the user name on the first page, then fill in the contact method, the third page fill in the relevant personal information, so that the three pages need to pass data, the previous usual method is The Hidden is a data. Now it is better to do it through State.

About State, we don't do a lot more, if you are interested, you can see http://www.fmexpense.com/quickstart/doc/stateoverview.aspx#ssionState This is its official description, but also blur. 6.5 Global.aspx

In ASP.NET, in order to highlight and ASP, it is especially changed to Global.asp to global.aspx but there is no big change. example:

Sub Application_Start () Response.write ("Application IS Starting ...
") End Sub

Sub session_start () response.write ("session is starting ...
) session.timeout = 1END SUB

This is very simple.

转载请注明原文地址:https://www.9cbs.com/read-41926.html

New Post(0)