Page 42 - DCAP312_WEB_TECHNOLOGIES_II
P. 42
Web Technologies-II
Notes <body>
<% =ServerSideFunction(pageVariable) %>
</body>
</html>
Write an inline code for a “Welcome!” page.
2.4 The Page Class
When an ASP.NET sheet is requested and renders score to a browser, ASP.NET creates an
instance of a class that represents your page. That class is unruffled not only of the code that
you wrote for the page, but also code that is generated by ASP.NET.
All web forms are really instances of the ASP.NET page class, which is definite in the System.
Web.UI namespace. The Page class inherits from the TemplateControl class, which in turn inherits
from the Control class. As a result, the Page class provides useful properties and methods that
we can use in our code.
2.4.1 Objects
Let us now discuss the various objects of the Page class.
Session
The session object is an example of the System.Web.SessionState.HttpSessionState class. It acts as
an international repository to store any type of user detailed data that needs to persist between
web-page requests. The session object stores data in the form of name/value pairs which is
used to maintain data like user’s name, user’s ID, a shopping cart and other elements which
are discarded when a user logs out or is not accessing any page of the web site. Session sate
can be both in process and out process.
Application
The Application object is an example of the System.Web.HttpApplicationState class. Similar to
session object, it also provisions data in the form of name/value pairs. However, the scope of
this data is global to the entire application.
Cache
Cache object is an example of the System.Web.Caching.Cache class. It also stores worldwide
information. It is also a name/value compilation of objects, but we can set modified finishing
policies and dependencies for each item so that items are automatically removed when other
resources, such as files or database tables, are modified.
Request
The request object is an instance of the System.Web.HttpRequest class. It represents the values
and properties of the HTTP request that caused our page to be loaded. It contains all the URL
parameters and all other information sent by the client.
36 LOVELY PROFESSIONAL UNIVERSITY