Beruflich Dokumente
Kultur Dokumente
NET
Applications
An ASP.NET application is a
combination of files, pages, handlers,
modules, and executable code that
can be invoked from a virtual
directory on a web server.
take a closer look at how an ASP.NET
application is configured and
deployed.
learn how to use components and
HTTP handlers with an ASP.NET
application.
Application Lifetime
ASP.NET uses a lazy initialization
technique for creating application
domains. This means that the
application domain for a web
application is created the first time a
request is received for a page in that
application.
ASP.NET automatically recycles
application domains when you
change the application.
Application Updates
ASP.NET performs the same
transition to a new application
domain that it performs when you
modify the web.config configuration
file.
However, its important to
understand the architecture that
makes it possible.
The CLR always locks assembly files
when it executes them.
The global.asax
The global.asax file allows you to
write event handlers that react to
global events.
Application Events
You can handle two types of events
in the global.asax file:
Events that always occur for every
request. These include requestrelated and response-related events.
Events that occur only under certain
conditions.
Interview Questions
What is global.asax in ASP.NET?
The global application class thats
used by the global.asax file should
always be stateless.
The global.asax file isnt the only
place where you can respond to
global web application events. You
can also create custom modules that
participate in the processing of web
requests.
ASP.NET Configuration
Configuration in ASP.NET is managed
with XML configuration files.
All the information needed to
configure an ASP.NET applications
core settings, as well as the custom
settings specific to your own
application, is stored in these
configuration files.
<processModel>
This section allows you to configure how
the ASP.NET worker process recycles
application domains, and the Windows
account it executes under, which
determines its privileges.
<machineKey>
This section allows you to set the
server-specific key used for encrypting
data and creating digital signatures.
You can use encryption in conjunction
with several ASP.NET features. ASP.NET
uses it automatically to protect the
forms authentication cookie, and you
can also apply it to protected view state
data
Configuration Inheritance
ASP.NET uses a multilayered
configuration system that allows you to
use different settings for different parts
of your application.
consider the web request
http://localhost/A/B/C/MyPage.aspx,
where A is the root directory for the web
application.
One reason you might want to use
multiple directories in an application is to
apply different security settings.
<location> :
The <location> element is an
extension that allows you to specify
more than one group of settings in
the same configuration file.
You use the path attribute of the
<location> element to specific the
subdirectory or file to which the
settings should be applied.
<configuration>
<system.web>
<!-- Basic configuration settings go
here. -->
</system.web>
<location path="/Secure">
<system.web>
<!-- Configuration settings for the
Secure subdirectory go here. -->
</system.web>
</location>
</configuration>
<system.web> Settings:
The <system.web> element contains
all the ASP.NET-specific configuration
settings.
These settings configure various
aspects of your web application and
enable services such as security,
state management, and tracing.
Authentication, authorization,
compilation, customErrors, identity,
httpHandlers, httpModules, pages,
sessionState, trace
<customErrors>
This element allows you to configure
the behavior of your application in
response to various HTTP errors.
<connectionStrings>
This section allows you to define
database connection strings that will be
used elsewhere in your application.
modified without recompiling the web
application
<appSettings>
You add custom settings to a
web.config file in a special element
called <appSettings>.
Custom settings are entered using an
<add> element that identifies a
unique variable name (the key) and
the variable contents (the value).
Email-Program:
Website Administration
Tool (WAT)
WAT to automate the web.config
changes
You make your changes using a
graphical interface (a web page), and
the WAT generates the settings you
need and adds them to the
web.config file for your application
behind the scenes.