The application of ASP.

Source: Internet
Author: User

Using system;using system.collections.generic;using system.linq;using system.web;using System.Web.UI;using System.web.ui.webcontrols;public partial class default2:system.web.ui.page{protected void Page_Load (object sender, E        Ventargs e) {application["App1"] = "value1";        application["App2"] = "value2";        application["APP3"] = "value3";        int N; for (N = 0; N < Application.count;            n++) {Response.Write ("Variable name:" + application.getkey (N));        Response.Write ("Variable Value:" + application.get (N) + "</br>");        } application.lock ();        application["APP1"] = "Zhang";        application["App2"] = "Wang";        application["APP3"] = "Li";        Application.UnLock ();        Modified variable response.write ("Modified variable Value </br>"); for (N = 0; N < Application.count;            n++) {Response.Write ("Variable name:" + application.getkey (N));      Response.Write ("Variable Value:" + application.get (N) + "</br>");  }} protected void button1_click (object sender, EventArgs e) {application.lock ();        application["Pageclick"] = (int) application["Pageclick"] + 1;        application["uservisit"] = (int) application["Uservisit"] + 1;        Application.UnLock (); Response.Write (String.        Format ("page click Number:{0}<br/>", application["Pageclick"])); Response.Write (String.    Format ("User access number:{0}<br/>", application["Uservisit"])); }}

<%@ application Language= "C #"%><script runat= "Server" > void          Application_Start (object sender, EventArgs e) {//code running at application startup application["Count"] = 0; } void Application_End (object sender, EventArgs e) {//code to run at application shutdown} void Application_er     Ror (object sender, EventArgs e) {//code to run in the event of an unhandled error} void Session_Start (object sender, EventArgs e)        {//code Application.Lock () running at new session startup;        application["Count"] = (int) application["Count"] + 1;    Application.UnLock ();         } void Session_End (object sender, EventArgs e) {//code that runs at the end of the session. Note: The Session_End event is raised only if the sessionstate mode in the Web. config file is set to//InProc.        If session mode//is set to StateServer or SQL Server, the event is not raised.        Application.Lock ();        application["Count"] = (int) application["Count"]-1;    Application.UnLock (); } </script> 

  

The application of ASP.

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.