Hi friends ...This articles is fully discuss about basics cocept that every web developer should know the thing..
APLICATION:
Its really very intrested to read about application ..Application is used to store the variables and objects to use throughout the entire application.And also you can share the stored variable in all pages.
In moreover the application and session state are same concept the main difference between the application and session is that the session state store and share the variables for one particular user,whereas the application layer store variables that all user, share the information at the same time.
Let us see one examble for Apllication..
Now by using appliation i created the counter for tthe page ...
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Application("counter") Is Nothing Then
Application("counter") = 1
Else
Application.Lock()
Application("counter") += 1
Application.UnLock()
End If
Label1.Text = Application("counter")
End Sub
In client side you have to add one label...
in serve side in load event just add the codings..
Now at the every time when the page load the counter will increment the count.This count store the variables for that all user using the page.
SESSION STATE:
Like application state the session state are used to store the temporary infromation in this page.But in session state the variable store the value for the current user using the page,But its deosnot the share the information to all user like application.
if you want to store the temporary infomation regarding the current use ,we can use session
textbox1.text=Session("username")
we can use the session for all pages in the application..
After closing the browser sesion has end at the particular time,this time property has set in GLOBAL.ASAX page.
CACHE:
cache is like similar to application,Both have shared the data between all user using the web application
By using insert the data is stored into cache ans also we have set the time using the time sapn till the time the data is present in the cache.
Cache.Insert("User", UserTable, Nothing,
DateTime.MaxValue, TimeSpan.FromMinutes(10))
COOKIES:
If you want to store data related to a particular user, you could use the Session object,but in session has as an important drawback: its contents are lost when the user closes the browser window
To store user data for longer periods of time, you need to use cookies .Cookies are not lost when the browser is closed (unless the user deletes them), so you can save data that helps identify your user in a cookie.