Understanding Application and Session
If someone does login to a website / application
using autotentifikasi (login) from a page to another page with the same user without having to enter autotentifikasi again it is certain someone is using session or cookies, so the session is a function that allows you to store one variable to be recognized. Session has a range of functions including berrbagai allows users to browse websites / applications that exist, besides it will make it easier for admins to make the application, monitoring and providing privileges to users using session or cookies. Both sessions or cookies have similar functions, session work
by storing a unique variable that is stored server side. This is what distinguishes between sessions with cookies, if the session is stored in server varibelnya but cookies are stored on the client. In the ASP application and session separated into an object
individual known as application and session objects. Active server works with a model based cookies to generate a unique id for the application
browser user on the first page request, the event session called
OnStart fires. This event set the scope of some properties for a period of unique browser session. At the same time, the event defines the timeout property to set the length of the session. Measuring the activity of the timeout property that has a browser cookie.
The user first sends requests a page from a directory
aplikasi1 (the directory where the application files on a web server) that makes web applications Attraction calling the Application and Session attractions. If another user sends
page request, the Application object and Session Additional attractions will be called. Calling for an Object Application will initiate events that execute scripts stored in the global.asa file. If the browser requests a page or file, the web server checks
if the browser is in an active session (condition before login). If not, then the web server sends the requested page as well as write the session id
as a cookie to the browser. Simultaneously Session OnStart event
execute scripts in global.asa file. With this cookie, the web server provides a unique id to monitor user. Id managing the Web server and also monitor the TimeOut property of the session.
global.asa file
Event model contained in the Session object and Application
describes a beginning to bring event-driven programming to the web.
Application and Session objects, each of which provides two events, namely
OnStart and OnEnd. Client calling this event when:
• Application OnStart: invoked the first time a user requests the file asp
from the application directory after starting the IIS service.
• Application OnEnd: called when all the session timeout.
• Session OnStart: called by the user when the browser requests an ASP page
from the application directory, whether first time or after the previous session had been canceled because of a few things.
• Session OnEnd: called after session timeout value of the property has been in
overshoots or canceled by the code in the application.
When users call the Application or Session event, you can
execute functions on a web server. All the code is on the call by the Session and Application events may be placed in the global.asa file. Here is a template
global.asa file:
Using Session
As previously described one session function is to
memanjemen user. That will facilitate the management of user for the user
Web browsing on the same server.
Session can be made in global.asa or we set on the page
concerned. Here are examples of each.
Save global.asa in the main folder that we use where we put
ASP files. Then we will make an application to display
teleh prove whether this session is running correctly. Here's the syntax:
Besides the way placed in global.asa session can also be placed on file
Gated we will use the session going. Here's an example:
Here's the result:
You can also disable the session that we did not use. In fact all
session because of something or another. To disable the session the following syntax:
<html>
<head>
<title>cek
global dot asa</title>
</head>
<br>
<%
Session("username")="arif"
Session("umur")=20
Session("tipe")="mahasiswa"
%>
<%
Session.Contents.Remove("username")
Session.Contents.Remove("umur")
%>
<br>
<b>Welcome</b>
<br>Nama
: <%Response.Write(Session("username"))%>
<br>Umur
: <%Response.Write(Session("umur"))%>
<br>Tipe
: <%Response.Write(Session("tipe"))%>
<body>
</body>
</html>
Description:
Because the content of the session username and age were removed will not be
appear if we run dibroser for the username and age.
The following looks:
We can see here that the name and age because we remove the function remove session. We can also remove all session with the same time by using Session.Contents.RemoveAll ()