Log in

Previous Entry | Next Entry

Application State is a kind of state management technique in asp.net which let you save the state of current application. Some points which need to be known about Application variables

  • It is stored in server memory.

  • It will be faster than storing and retrieving values from database.

  • Unlike session state which is specific to a single user session, application state is available to all users and sessions.

On the second place, static variables severs the same purpose.

  • If we declare any variable as static it will retain the memory till our application is running. In short life of static variable is equal to life of application.

  • Like Application, They will be available to all users and sessions.

How both are different then?

  • From Performance point of view I will prefer static, because static variables provide type safety.

  • Compile time error check for wrong values also makes static variables better than application variables.

  • When it comes to locking Application variables are better choice, because Applicatin.Lock method will lock all application variables, whereas in case of static separate synchronization logic is required for every variable. But if you want to lock only one application level values static wins over application variables.

  • Last but not the least, application variables wins when it comes to migration from classic asp to Asp.net because classic asp won’t have support for static variables.

Do see the below video on ASP.NET MVC interview questions Video which discussed the difference between viewdata,viewbag,tempdata and session variables.

Copy right www.questpond.com


Buy 600+ Real Time Interview Videos

Call +91-22-66752917 or mail us on questpond@questpond.com for more details on C#, .NET, ASP.NET, SQL Server interview question videos.

SQL Server interview question videos

Latest Month

January 2017


Powered by LiveJournal.com