Asp.net--application object, Session object, server object __.net

Source: Internet
Author: User

One, Application object

It is equivalent to an application set, similar to a global variable, so it can be shared, primarily to implement page usage information in your application, such as database connection information. Method is a collection, key, and key-value pairs.

such as the Lock method:

<%
application.lock
application ("visits") =application ("visits") +1
application.unlock
%> This

page has been visited
<%=application ("visits")%> times!

You can prevent more than one user from accessing the visits at the same time and unlocking it with unlock.


Second, Session object

Used to store or change information about a user's session, he is the interaction between each user and the server, so he is local.

For example, traversing the content collection

<% for each
x in application.contents
  Response.Write (x & "=" & Application.Contents (x) & "<br& gt; ")
Next
%>

or:

<% for
i=1 to Application.Contents.Count
  Response.Write (i & "=" & Application.Contents (i) & "<br>")
Next
%>


Three, the server object.

Used to get the call between the server information and the local.

For example, you cannot create an object with the same name as a built object

<%
Set application=server.createobject ("Application")
%>
In summary, the entire application has only one application object, and everyone can access the Server,session object. Their methods, as well as their usefulness, require us to continue to explore. Come on.


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.