Application State in ASP.NET using VB.NET

In this article you Learned what is Application State and how you can set Application key value pair.
  • 2309
Download Files:
 

Introduction

Application state is one of the server side state management Mechanism which stores application memory on the server rather than persisting data in the Client side memory. Application state is a convenient repository for global data in a web application. Its use can severely limit the scalability of an application. Especially if it is used to store shared, updateable state. It is also an unreliable place to store data, because it is replicated with each application instance and is not saved if the application is recycled.
Application state is access through the Application Property of the HttpApplication Class, which returns an instance of class HttpApplicationState. This class is a named object Collection, which means that it can hold data of many type as part of a Key/Pair value.
Here we are discussing an example that how can you set Application key value pair.

Getting Started

  • Simply Create a new ASP.NET web application.
  • Then write  some Text on your page as shown in below page.

    application1.gif
     
  • Attach the below code to set key value pair.

    <%@ Page Title="Home Page" Language="vb"  AutoEventWireup="false"
        CodeBehind="Default.aspx.vb" Inherits="Application._Default" %>
     
    <html>
      <body>
        <%    
            Application(
    "Application Number") = "555 1234"
        %>
       
    <b>Application state changed successfully</b>
        <b>Application Number = <% Response.Write(Application("Application Number"))%></b>
      </body>
    </
    html>
     
  • Now run your application.

Output

application2.gif

Summary 
In this article you Learned about Application State and how to set Application key value pair.

Categories

More Articles

© 2019 DotNetHeaven. All rights reserved.