Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 10

What is ASP.NET?

ASP.NET is a server side scripting technology that enables scripts (embedded in web pages) to be
executed by an Internet server.

ASP.NET is a Microsoft Technology

ASP stands for Active Server Pages

ASP.NET is a program that runs inside IIS

IIS (Internet Information Services) is Microsoft's Internet server

Note: ASP+ is just an early name used by Microsoft when they developed ASP.NET.

How Does ASP.NET Work?

When a browser requests an HTML file, the server returns the file

When a browser requests an ASP.NET file, IIS passes the request to the ASP.NET engine on

The ASP.NET engine reads the file, line by line, and executes the scripts in the file

Finally, the ASP.NET file is returned to the browser as plain HTML

Features of ASP.NET
1.
2.

3.
4.
5.
6.
7.
8.

Language Support: ASP.NET uses ADO.NET and supports full Visual Basic, ASP.NET supports
C#, C++, JScript.
ASP.NET Controls: ASP.NET control objects that can be controlled by scripts. ASP.NET also
contains a new set of object-oriented input controls, like programmable list-boxes and
validation controls.
Event Aware Controls: All ASP.NET objects on a Web page can expose events like Load, Click
and Change events handled by code makes coding much simpler and better organized.
ASP.NET Components: ASP.NET components are heavily based on XML.
User Authentication: ASP.NET supports form-based user authentication, cookie
management, and automatic redirecting of unauthorized logins.
High Scalability: ASP.NET provides greater scalability. Server-to-server communication has
been greatly enhanced, making it possible to scale an application over several servers.
Compiled Code: The first request for an ASP.NET page on the server will compile the ASP.NET
code and keep a cached copy in memory. The result of this is greatly increased performance.
Easy Configuration and Deployment: Configuration of ASP.NET is done with plain text files.
Configuration files can be uploaded or changed while the application is running.

Facilities in ASP.Net
1.

Master Pages: A master page is a template for other pages, with shared layout and functionality.
The master page defines placeholders for content pages. The result page is a combination (merge)
of the master page and the content page.

2.

3.

Themes: Themes allow developers to create a customized look for web applications. Design goal
for theme are:
a) to make it simple to customize the appearance of a site
b) Allow themes to be applied to controls, pages, and entire sites
c) Allow all visual elements to be customized
Web Parts: ASP.NET 2.0 Web Parts can provide a consistent look for a site, while still allowing
user customization of style and content.
a) New controls: Zone controls - areas on a page where the content is consistent
b) Web part controls - content areas for each zone

4.
5.
6.
7.
8.
9.

Security: Security is very important for protecting confidential and personal information. In
ASP.NET 2.0 the Login controls has been added, specifically, for this security purpose.
Roles and Personalization: Internet communities are growing very popular. ASP.NET 2.0 has
personalization features for storing user details.
Internationalization: Reaching people with different languages is important if you want to reach
a larger audience. ASP.NET 2.0 has improved support for multiple languages.
Data Access: A key goal of ASP.NET 2.0 was to ease the use of data sources. ASP.NET 2.0 has
new data controls, removing much of the need for programming and in-depth knowledge of data
connections.
Mobility Support: The problem with Mobile devices is screen size and display capabilities. In
ASP.NET, the Microsoft Mobile Internet Toolkit (MMIT) provided this support. In ASP.NET 2.0, MMIT
is no longer needed because mobile support is built into all controls.
Images: ASP.NET 2.0 has new controls for handling images:
a) The ImageMap control - image map support
b) The DynamicImage control - image support for different browsers

10. Automatic Compilation: ASP.NET 2.0 provides automatic compilation. An entire web site can be
pre-compiled. This provides an easy way to deploy compiled an applications, and because only
compiled files are deployed, the source code is protected.

The Microsoft .NET Framework


The .NET Framework is the infrastructure for the Microsoft .NET platform. The .NET Framework is an
environment for building, deploying, and running Web applications and Web Services.
The features of .NET Frameworks are:

Easier and quicker programming

Reduced amount of code

Declarative programming model

Richer server control hierarchy with events

Larger class library

Better support for development tools

The .NET Framework consists of 3 main parts:

1.

2.

3.

Programming languages:
a. C# (Pronounced C sharp)
b. Visual Basic (VB .NET)
c. J# (Pronounced J sharp)
Server technologies and client technologies:
a. ASP .NET (Active Server Pages)
b. Windows Forms (Windows desktop solutions)
c. Compact Framework (PDA / Mobile solutions)
Development environments:
a. Visual Studio .NET (VS .NET)
b. Visual Web Developer

ASP.NET has better language support, a large set of new controls, XML-based components, and better
user authentication. ASP.NET provides increased performance by running compiled code.

ASP.NET - Server Controls


Server controls are tags that are understood by the server. There are three kinds of server controls:

HTML Server Controls - Traditional HTML tags

Web Server Controls - New ASP.NET tags

Validation Server Controls - For input validation

ASP.NET - HTML Server Controls


HTML server controls are HTML tags understood by the server. HTML elements in ASP.NET files are, by
default, treated as text. To make these elements programmable, add a runat="server" attribute to the
HTML element. This attribute indicates that the element should be treated as a server control. The id
attribute is added to identify the server control. The id reference can be used to manipulate the server
control at run time. It also indicates that the enclosed controls can be accessed by server scripts.
The syntax for creating a Web server control is:
<a id="id_name" runat="server">Tag</a>
HTML Server Control

Description

HtmlAnchor

Controls an <a> HTML element

HtmlButton

Controls a <button> HTML element

HtmlForm

Controls a <form> HTML element

HtmlGeneric

Controls other HTML element not specified by a specific HTML


server control, like <body>, <div>, <span>, etc.

HtmlImage

Controls an <image> HTML element

HtmlInputButton

Controls <input type="button">, <input type="submit">,


and <input type="reset"> HTML elements

HtmlInputCheckBox

Controls an <input type="checkbox"> HTML element

HtmlInputFile

Controls an <input type="file"> HTML element

HtmlInputHidden

Controls an <input type="hidden"> HTML element

HtmlInputImage

Controls an <input type="image"> HTML element

HtmlInputRadioButton

Controls an <input type="radio"> HTML element

HtmlInputText

Controls <input type="text"> and <input type="password">


HTML elements

HtmlSelect

Controls a <select> HTML element

HtmlTable

Controls a <table> HTML element

HtmlTableCell

Controls <td>and <th> HTML elements

HtmlTableRow

Controls a <tr> HTML element

HtmlTextArea

Controls a <textarea> HTML element

ASP.NET - Web Server Controls


Web server controls are special ASP.NET tags understood by the server. Like HTML server controls,
Web server controls are also created on the server and they require a runat="server" attribute to
work. However, Web server controls do not necessarily map to any existing HTML elements and they
may represent more complex elements.
The syntax for creating a Web server control is:
<asp:control_name id="some_id" runat="server" />

Web Server Control

Description

AdRotator

Displays a sequence of images

Button

Displays a push button

Calendar

Displays a calendar

CalendarDay

A day in a calendar control

CheckBox

Displays a check box

CheckBoxList

Creates a multi-selection check box group

DataGrid

Displays fields of a data source in a grid

DataList

Displays items from a data source by using templates

DropDownList

Creates a drop-down list

HyperLink

Creates a hyperlink

Image

Displays an image

ImageButton

Displays a clickable image

Label

Displays static content which is programmable (lets you apply


styles to its content)

LinkButton

Creates a hyperlink button

ListBox

Creates a single- or multi-selection drop-down list

ListItem

Creates an item in a list

Literal

Displays static content which is programmable(does not let


you apply styles to its content)

Panel

Provides a container for other controls

PlaceHolder

Reserves space for controls added by code

RadioButton

Creates a radio button

RadioButtonList

Creates a group of radio buttons

BulletedList

Creates a list in bullet format

Repeater

Displays a repeated list of items bound to the control

Style

Sets the style of controls

Table

Creates a table

TableCell

Creates a table cell

TableRow

Creates a table row

TextBox

Creates a text box

Xml

Displays an XML file or the results of an XSL transform

ASP.NET - Validation Server Controls


Validation server controls are used to validate user-input. If the user-input does not pass validation, it
will display an error message to the user. Each validation control performs a specific type of validation
(like validating against a specific value or a range of values). By default, page validation is performed
when a Button, ImageButton, or LinkButton control is clicked. You can prevent validation when a
button control is clicked by setting the CausesValidation property to false.
The syntax for creating a Validation server control is:
<asp:control_name id="some_id" runat="server" />

Validation Server Control

Description

CompareValidator

Compares the value of one input control to the


value of another input control or to a fixed value

CustomValidator

Allows you to write a method to handle the


validation of the value entered

RangeValidator

Checks that the user enters a value that falls


between two values

RegularExpressionValidator

Ensures that the value of an input control matches


a specified pattern

RequiredFieldValidator

Makes an input control a required field

ValidationSummary

Displays a report of all validation errors occurred in


a Web page

ASP.NET Login Controls:


ASP.NET provides robust login (authentication) functionality for ASP.NET Web applications without
requiring programming. One can restrict access to ASP.NET pages by putting them into a protected
folder. You then configure the folder to deny access to anonymous users (users who are not logged in)
and to grant access to authenticated (logged-in) users..

Note: Login controls might not run function correctly if Method of ASP.net Web Page is changed from
POST to GET.
It includes following controls:

The
The
The
The
The
The
The

Login Control
LoginView Control
LoginStatus Control
LoginName Control
PasswordRecovery Control
CreateUserWizard Control
ChangePassword Control

The descriptions of the controls are:


1.

2.

3.

4.
5.

6.

7.

The Login Control: The Login control displays a user interface for user authentication. The
Login control contains text boxes for the user name and password. The Login control can be
used as a standalone control on page.
The LoginView Control: The LoginView control allows you to display different information to
anonymous and logged-in users. The control displays one of two templates: the
AnonymousTemplate or the LoggedInTemplate. The LoginView control also includes events for
ViewChanging and ViewChanged, which allow you to write handlers for when the user logs in
and changes status.
The LoginStatus Control: The LoginStatus control displays a login link for users who are not
authenticated and a logout link for users who are authenticated. The login link takes the user
to a login page. The logout link resets the current user's identity to be an anonymous user.
The LoginName Control: The LoginName control displays a user's login name if the user has
logged in using ASP.NET membership.
The PasswordRecovery Control: The PasswordRecovery control allows user passwords to
be retrieved based on the e-mail address that was used when the account was created. The
PasswordRecovery control sends an e-mail message containing a password to the user.
The ChangePassword Control: The ChangePassword control allows users to change their
password. The user must first supply the original password and then create and confirm the
new password. If the original password is correct, the user password is changed to the new
password. The control also includes support for sending an e-mail message about the new
1password.
The CreateUserWizard Control: The CreateUserWizard control collects information from
potential users. By default, the CreateUserWizard control adds the new user to the ASP.NET
membership system.The CreateUserWizard control gathers the following user information:
(1) User name
(2) Password
(3) Confirmation of password
(4) E-mail address
(5) Security question
(6) Security answer

ASP.NET validation controls


ASP.NET validation controls allow you to check user input on a web page. There are controls for
different types of validation, such as range checking or pattern matching. Each validation control
references an input control (a server control) elsewhere on the page. When user input is being
processed, the validation control tests the user input and sets a property to indicate whether the entry
passed the test. After all of the validation controls have been called, a property on the page is set
indicating whether any validation check has failed.

The ASP.net validation includes following controls:


1.

2.

3.

4.
5.

CompareValidator: The CompareValidator control compares a user's entry against a


constant value, against the value of another control (using a comparison operator such as less
than, equal, or greater than), or for a specific data type.
CustomValidator: The CustomValidator control checks the user's entry using validation logic
that you write yourself. This type of validation enables you to check for values derived at run
time. RangeValidator:
RegularExpressionValidator: The RegularExpressionValidator control checks that the entry
matches a pattern defined by a regular expression. This type of validation enables you to
check for predictable sequences of characters, such as those in e-mail addresses, telephone
numbers, postal codes, and so on.
RequiredFieldValidator: The RequiredFieldValidator control ensures that the user does not
skip an entry.
ValidationSummary: The ValidationSummary control does not perform validation, but is
often used in conjunction with other validation controls to display the error messages from all
the validation controls on the page together.

Web Site Navigation


Maintaining the menu of a large web site is difficult and time consuming. In ASP.NET 2.0 the menu can
be stored in a file to make it easier to maintain. In ASP.NET 2.0 has three new navigation controls:

1.
2.

3.

1.

Dynamic menus

2.

Tree Views

3.

Site Map Path

Dynamic Menu: The <asp:Menu> control displays a standard site navigation menu. The
<asp:SiteMapDataSource> control automatically connects to the default sitemap file
(web.sitemap).
TreeView: The <asp:TreeView> control displays a multi level navigation menu. The menu looks
like a tree with branches that can be opened or closed with + or - symbol.
The
<asp:SiteMapDataSource> control automatically connects to the default sitemap file
(web.sitemap).
SiteMapPath: The SiteMapPath control displays the trail (navigation path) to the current page.
The path acts as clickable links to previous pages. The SiteMapPath control uses the web.sitemap
file by default.

Master Pages
Master Pages define the overall layout of the web application.Master pages allow you to create a
consistent look and behavior for all the pages (or group of pages) in your web application. A master
page provides a template for other pages, with shared layout and functionality. The master page
defines placeholders for the content, which can be overridden by content pages. The output result is a
combination of the master page and the content page. The content pages contain the content you
want to display.
When users request the content page, ASP.NET merges the pages to produce output that combines
the layout of the master page with the content of the content page.
Ex.

<%@ Master %>


<html>
<body>

<h1>Standard Header For All Pages</h1>


<asp:ContentPlaceHolder id="CPH1" runat="server">
</asp:ContentPlaceHolder>
</body>
</html>
<%@ Page MasterPageFile="master1.master" %>
<asp:Content ContentPlaceHolderId="CPH1" runat="server">
<h2>Individual Content</h2>
<p>Paragraph 1</p>
<p>Paragraph 2</p>
</asp:Content>
The key features of the master page are:
1.
2.
3.

A master page defines the common properties of the website.


It allows single or multiple content pages to access single or multiple master pages
It displays the contents of each content page in the master pages contentholder.

Localization and Globalization


Globalization is defined as the process of developing a program or an application so that it is usable
across multiple cultures and regions, irrespective of the language and regional differences.
Ex. For example, a small inventory management program deployed in English needs to be
used in German too.
Localization is the process of creating content, input, and output data, in a region specific culture and
language. Culture will decide date display settings (like, mm/dd/yyyy or dd/mm/yyyy), currency
display formats etc. Now, the process by which we can make sure that our program will be localized is
known as Internationalization or Globalization. In simpler terms, Globalization can be defined as the
set of activities which will ensure that our program will run in regions with different languages and
cultures.
So, globalization is related to intrinsic code changes to support such changes like using Resource files
etc. On the other hand, localization is the process of using a particular culture and regional
information so that the program uses the local languages and culture. This means translating strings
into a particular local language. This covers putting language specific strings in the resource files.
Globalization starts in the main construction phase along with the code development. Localization
general ly comes later.
They can be provided support for Localization and Globalization to the application using
System.Globalization, System.Resources and System.Threading namespaces. A web form has two
culture values, Culture and UICulture. Culture value is used for date and number formatting and
UICulture values are used to determine culture specific resources.
One can set culture and UICulture values in the application by modifying the code in @page directive
of<globalization> element of Web.Config as;\
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture ("en-GB");
Thread.CurrentThread.CurrentUICulture=new CultureInfo("en-GB");

ASP.NET Authentication:
ASP.NET implements additional authentication schemes using authentication providers, which are
separate from and apply only after the IIS authentication schemes. ASP.NET supports the following
authentication providers:
1.
2.
3.
4.

Windows (default)
Forms
Passport
None

To enable an authentication provider for an ASP.NET application, use the authentication element in
either machine.config or Web.config as follows:
<system.web>
<! -- mode=[Windows|Forms|Passport|None] -->
<authentication mode="Windows" />
</system.web>

1. Windows: The Windows authentication provider relies upon IIS to perform the required
authentication of a client. After IIS authenticates a client, it passes a security token to
ASP.NET. ASP.NET constructs and attaches an object of the WindowsPrincipal Class to the
application context based on the security token it receives from IIS. It authenticates using
Windows accounts. It may require the use and management of individual Windows user
accounts.
2. Forms (Cookie): The Forms authentication provider is an authentication scheme that makes
it possible for the application to collect credentials using an HTML form directly from the client.
The client submits credentials directly to your application code for authentication. If your
application authenticates the client, it issues a cookie to the client that the client presents on

subsequent requests. If a request for a protected resource does not contain the cookie, the
application redirects the client to the logon page. It can be used for personal authentication.
3. Passport: The Passport authentication provider is a centralized authentication service
provided by Microsoft that offers a single logon and core profile services for member sites.
Passport is a forms-based authentication service. When member sites register with Passport,
the Passport service grants a site-specific key. The Passport logon server uses this key to
encrypt and decrypt the query strings passed between the member site and the Passport
logon server.
4. None (Custom Authentication): Specify "None" as the authentication provider when users
are not authenticated at all or if you plan to develop custom authentication code. It offers
total control of the authentication process providing the greatest flexibility.

You might also like