Chapter 1

ASP.NET Features (continued)

  • Improved Security
  • Greater Scalability
  • Cookie-less Sessions
  • Easy Configuration and Deployment


Improved Security



In ASP, the only type of authentication that you can use is the Windows
authentication, whereas ASP.NET allows different types of logon and user
authentication: Windows, Passport, and Cookies.

ASP.NET also enables you to get real account impersonation and have the
server execute code as if the user were present. You can also programmatically
check to see if the user is in a given role and conditionally let him or her
perform certain tasks when given permission.


In addition, creating forms-based authentication, in whic h you can create your
own custom logon screen and credential checking, is much easier if you are
using ASP.NET.


For more information about authentication and creating login forms, see
Module 7, “Creating a Microsoft ASP.NET Web Application,” in Course
2063B, Introduction to Microsoft ASP.NET. 


Greater Scalability


In ASP.NET, session state can now be maintained in a separate process on a
separate machine or database, allowing for cross-server sessions. This allows
you to add more Web servers as your traffic grows.



Cookie-less Sessions


ASP.NET enables you to use session state even with browsers that have cookie
support disabled. Cookie-less sessions use Uniform Resource Locators (URLs),
as opposed to cookies, to pass the SessionID to an ASP.NET page. A cookieless
session involves encoding data into a URL, which is done automatically by
the browser.


For more information about maintaining state, see Module 7, “Creating a
Microsoft ASP.NET Web Application,” in Course 2063B, Introduction to
Microsoft ASP.NET.


Easy Configuration and Deployment


Configuration and deployment are now easier with the use of human-readable
configuration files and DLLs that do not need to be registered.


In ASP.NET, all the configuration details for all Web applications are kept in
human-readable files named web.config. The standard format for the
configuration files is XML, and each application inherits the settings in the
default web.config file.


With .NET, all files that a Web site needs are located under the site’s root
folder. DLLs are in the /bin folder, and the web.config file is in the root folder.
To deploy a Web site, all you need to do is copy the site’s root folder by using
file copy commands, the Microsoft FrontPage® server extensions, or File
Transfer Protocol (FTP).


For more information about configuration options, see Module 7, “Creating a
Microsoft ASP.NET Web Application,” in Course 2063B, Introduction to
Microsoft ASP.NET.


Animation: ASP.NET Execution Model



In this animation, you will see how ASP.NET pages are processed on the server.
To view the animation, open the 2063B_01A001.swf file from the Media
folder.

The following table describes the elements that are depicted in the animation.

Element                  Description
                                                                                                                                                     
Parser                      The parser checks and interprets the contents of the aspx page and
                               passes the page to a compiler.

Compiler                  The run-time compiler is responsible for compiling the contents of
                               the page into an intermediate language.

Assembly Cache      Each machine on which the Microsoft .NET Framework is installed
                               has a machine-wide code cache called the assembly cache. One of
                               the functions of the assembly cache is to hold the native code
                               versions of pages that have been pre-compiled.

Memory                   Some items that are expensive to construct can be built once and
                               used for a period of time before they are considered invalid. These
                               items are stored in memory where they can be efficiently retrieved
                               without incurring the cost of being reconstructed.

Output Cache           The output cache is a cache for entire pages, including their objects
                               and data. After a page is built, it can be placed in the output cache.
                               If a user makes another request for the page, the request is returned
                               from the output cache.

Creating Web Forms

  • What Are Web Forms?
  • What Are Server Controls?
  • Types of Server Controls
  • How Do Server Controls Work?
  • Demonstration: 
  • Adding Server Controls to an ASP.NET Page
ASP.NET introduces the concept of server controls that encapsulate common
tasks and provide a clean programming model. In this section, you will learn
about types of server controls and see how they work. You will also learn how
to use server controls on ASP.NET pages.

What Are Web Forms?



  • .aspx extension
  • @Page Directive                                                                                      <%@ Page Language="vb" %>
  • Framework Is an Object Model
  • Denoted by the runat="server" Attribute                                                   <Form runat="server">
    </Form>
  • Contain Client-side and Server-side Code
  • Contain HTML and Server Controls

Web Forms divide Web applications into two pieces: the visual component and
the user interface logic.


  • Web Forms have an .aspx extension                                                               Web forms are commonly referred to as ASP.NET pages or ASPX pages. They have an .aspx extension and work as the containers for the text and controls that you want to display.
  • @Page directive                                                                                             The @Page directive defines page-specific attributes that are used by the ASP.NET page parser and compiler. You can set the language attribute to the language that will be used throughout all code on the page.                                                                                                                                      You can include only one @ Page directive per .aspx file.
  • The Web Forms framework is an object model                                        Although you create Web forms from separate components, they form a unit. When the Web form is compiled, ASP.NET parses the page and its code, generates a new class dynamically, and then compiles the new class. The dynamically generated class is derived from the ASP.NET Page class, but is extended with controls, your code, and the static HTML text in the .aspx file. This is different from AS P. In ASP, the page consists of static HTML interspersed with executable code. The ASP processor reads the page, extracts and runs the code, and then inserts the results back into the static HTML before sending the results to the browser.
        Unlike controls in an ASP form, all intrinsic controls in an ASP.NET form
        are objects. Therefore, all the controls on a form have properties, methods,
        and events.

Go to page 1  2