Presentation is loading. Please wait.

Presentation is loading. Please wait.

Alexey Polovinkin Post graduate student, CMC department.

Similar presentations


Presentation on theme: "Alexey Polovinkin Post graduate student, CMC department."— Presentation transcript:

1 Alexey Polovinkin Post graduate student, CMC department

2  Anatomy of ASP.NET application  The global.asax application file  ASP.NET configuration .NET Components  Extending HTTP pipeline

3  All the web pages in a single web application: ◦ share the same in-memory resources (global application data, per-user session data, cached data) ◦ share the same core configuration settings  Virtual directory is the basic grouping structure that delimits ASP.NET applications

4  web pages (.aspx files)  web services (.asmx files)  WCF services (.svc files)  core-behind files  a configuration file (web.config)  global.asax  other components

5  ASP.NET uses lazy initialization technique for creating application domains.  Application can restart himself in new application domain: ◦ in response to error conditions; ◦ depending on settings in the computer-wide machine.config file, when certain thresholds are reached (length of application domain runtime, the number of queued requests, the amount of memory used, etc.) (see chapter 18) ◦ when application is changed (modifying web.config, replacing existing web page or DLL assembly)  ASP.NET starts new application domain to handle all future requests and keeps the existing application domain alive long enough to finish handling requests.

6  There is an opportunity to update ASP.NET application without needing to restart web server and without worrying about existing clients.  ASP.NET uses shadow copy technique  ASP.NET ability to detect changing original files relies on ability of Windows system to track directories and files and send immediate change notification.  You can use assemblies from GAC and put your own assemblies into GAC.

7 DirectoryDescription BinAll the precompiled.NET assemblies (usually DLLs) that the ASP.NET web application uses App_CodeSource code files that are dynamically compiled for application App_Global Resources Global resources that are accessible to every page in the web application App_Local Resources Resources that are accessible for dedicated pages only App_Web References References to web services that web application uses (WSDL files and discovery documents) App_DataData storage, including SQL Server 2005 Express database files and XML files App_BrowsersBrowser definitions stored in XML files (see Chapter 27) App_ThemesThe themes used by the web application (see Chapter 16)

8  contains event handlers to react global events  defines the methods for application class (derives from HttpApplication)  doesn’t contain any HTML or ASP.NET tags

9

10  Application_Start()  Session_Start()  Application_Error()  Session_End()  Application_End()  Application_Disposed()

11

12  %WINDIR%\Microsoft.NET\Framework\v2.0.50727\Config  defines supported configuration file sections;  configures ASP.NET worker process;  registers providers for advanced features (profile, membership, role-based security)

13  configure how ASP.NET worker process recycles application;  configure Windows account it executes under;  Ignored by IIS >= 6.0

14  Allow to set the server-specific key used for encrypted data and creating digital signatures ◦ machine specific, application specific keys ◦ single key for all applications on the computer ◦ definition of the keys explicitly ◦ definition of the application-specific keys explicitly in the web.config file

15  validationKey value can be from 40 to 128 characters long  decriptionKey value can be either 16(DES) or 48(3DES) characters long  safety rules: ◦ use maximum length key available ◦ use.NET Framework cryptography classes (System.Security.Cryptography namespace)

16  - entire content of ASP.NET configuration ◦ - ASP.NET configuration settings ◦ - store custom application settings ◦ - store connection strings to databases.

17

18

19  Allows to specify more than one group of settings in the same configuration file

20  section can be used to lock specific settings so they can’t be overridden

21

22 you can use as few or as many configuration sections as you want web.config file is case-sensetive

23  allows to configure the behavior of ASP.NET application to response to various HTTP errors  Supported modes: ◦ On – custom errors are enabled; ◦ Off – custom errors are disabled; ◦ RemoteOnly – custom errors are shown only to remote clients but full detailed errors are displyed to local clients  Custom error settings defined in configuration file come into effect only if ASP.NET is handling the request

24  allows to define database connection strings that will be used in application

25  allows adding custom settings to the application 

26  System.Configuration namespace  ConfigurationSettings class  AppSettings property

27  System.Web.Configuration namespace  WebConfigurationManager class

28  OpenWebConfiguration() method reflects the cumulative configuration for the current application  OpenWebConfiguration() method returns Configuration object that contains all configuration information

29  element can be used to store custom information that application uses, but ◦ it doesn’t provide a way to store structured information ◦ it’s limited to single strings  to extend a configuration file: ◦ determine information to store in configuration file and its structure ◦ for each element create C# class that encapsulates information ◦ register new element in configuration file (use element)  Example

30  ASP.NET supports two encryption options: ◦ RSA ◦ DPAPI (data protection API)  Programmatic encryption ◦ ProtectSection() – encrypt data in section; ◦ UnprotectSection() – switch off encryption;  Command-line encryption (with regiis_asp) ◦ -pe specifies configuration section to encrypt ◦ -app specifies web application’s virtual path ◦ -prov specifies provider name

31  Two ways to create a component: ◦ Create a new.cs file in the App_Code subdirectory ◦ Create a new class library project in Visual Studio

32

33  HTTP handlers are defined in section of configuration file (nested in the element)  - register new handler  - unregister existing handler

34  participate in processing of a request by handling application events  a request can flow trough multiple HTTP modules but it always ends with single HTTP handler

35  HTTP modules are defined in section of configuration file (nested in the element)  - register new module  - unregister existing module

36  To create a custom HTTP handler you need to make a class that implements IHttpHandler interface

37  verb = “*” (use for both HTTP POST and HTTP get requests)  path – indicates the file extension that will invoke HTTP handler  type – identifies HTTP handler class

38  To create a custom HTTP handler you need to make a class that implements IHttpHandler interface


Download ppt "Alexey Polovinkin Post graduate student, CMC department."

Similar presentations


Ads by Google