Session and Application
Session
A session is the time for which a particular user interacts with a web application. During a
session the unique identity of the user is maintained internally. A session ends if there is a
session timeout or if you end the visitor session in code.
Use of Session
Sessions helps to preserve data across successive accesses. These can be done on a per user
basis, via the use of session objects. Session objects give us the power to preserve user
preferences and other user information when browsing a web application.
Session object
A Session object stores information about, or change settings for a user session.
When we are working with an application on our computer, we open it, do some changes and
then we close it. This is much like a Session. The computer knows who we are. It knows when
we open the application and when we close it. However, on the internet there is one problem: the
web server does not know who we are and what we do, because the HTTP address doesn't
maintain state.
ASP solves this problem by creating a unique cookie for each user. The cookie is sent to the
user's computer and it contains information that identifies the user. This interface is called the
Session object.
The Session object stores information about, or change settings for a user session.
Variables stored in Session object hold information about one single user, and are available to all
pages in one application. Common information stored in session variables is name, id, and
preferences. The server creates a new Session object for each new user, and destroys the Session
object when the session expires.Session Start:
A session starts when:
+ A new user requests an ASP file, and the Global.asa file includes a Session_OnStart
lure
+ A value is stored in a Session variable ' a
+ A.user requests an ASP file, and the Global.asa file uses the
17.
T have written the above code to create the polygon hotspots. In this code I have taken two
PolygonHotSpots, first for green and second for yellow button, So if we move the mouse over
hotspot area, it will show the name of area in tooltip
If we click on hotspot, it will display some information related to that hotspot. So I have written
the following line of code to perform some action when it is clicked.
1. protected void ImageMapDemo_Click(object sender, ImageMapEventArgs e)
2 {
3. var hostspotValue = e.PostBackValue;
4. var messageText = string. Empty;
5.
6. switch (hostspotValue.ToLower())
2
8 case "green"
9. messageText = "You clicked on :" + "Yellow Po
lygon
‘SqlConnection con = new
SqlConnection(ConfigurationManager.ConnectionStrings{"cons"].Connectionstring);
iv) _ iff database is not in AppData folder then its extension is not mdf and is a part of SQL Server
manager not of your application ‘ll result in a change like:
‘SqlConnection con = new
sqlConnection("server=.\\SQLEXPRESS;Database-Databasel integrated Security=True;User
Instance=True;trusted_connection=yes");