Intro To ASP NET
Intro To ASP NET
SEMINAR REPORT
ON
ASP.NET
Contents
1. Introduction
4. ASP.NET Architecture
8. Conclusion
2
1. Introduction
ASP.NET is the platform used to create Web applications and Web services
that run under IIS (Internet Information Service).
ASP.NET is more than the next version of Active Server Pages (ASP); it is a
unified Web development platform that provides the services necessary for
developers to build enterprise-class Web applications. While ASP.NET is
largely syntax compatible with ASP, it also provides a new programming
model and infrastructure for more secure, scalable, and stable applications.
Developers can choose from the following two features when creating an
ASP.NET application, Web Forms and Web services, or combine these in any
way they see fit. Each is supported by the same infrastructure that allows
using authentication schemes; cache frequently used data, or customizes
application’s configuration, to name only a few possibilities.
3
The Internet allows people from all over the world to communicate with each
other via their computers. This technology has brought about many new
possibilities, including e-mail, instant messaging and the World Wide Web.
Originally, web sites were very simple. There were only HTML pages on any
topic .people could share whatever they liked, those early pages were static-
visitors could not interact with them in any way.
The Web quickly evolved and new levels of functionality were added,
including images, tables, and forms. This finally allowed visitors to interact
with Web sites, giving rise to guest books and user polls. Web site developers
began to build other neat little tricks into their sites, such as image rollovers
and dropdown menus.
This allowed interactivity, but true dynamic content was still lacking. Then
server processing was introduced. A visitor can now interact with database,
process content, and determine new types of visitor demographics over the
Web.
ASP.Net is a server technology that brings together the different pieces of the
Web to give Web sites developer more power than ever.
Dynamic processing
The internet works on the client /server model .Two computers work
together, sending information back and forth, to perform a task. The most
common scenario is communication between a server (a computer that holds
information) and a client (a computer that wants the information).
The client computer sends a request for information to he server, the server
then responds to the client with the information that was requested of it. This
paradigm is the request/response model, and it is an integral part of the
4
On the other hand in server processing the server takes a look at what it
sends before it sends it, and it can take orders from the client. The server can
return dynamic data, such as that from a database, calculations it performs
and anything else the client may ask for. The modified work flow is as follows:
There’s another model for communicating between servers and clients, known
as the event-driven model. The server waits around for something to happen
on the client. Once it does the server takes action and performs some piece of
functionality. This model is much easier for building applications than using a
request/response scenario.
ASP.net works in this way-it detects actions and responds to them.
Client-side processing
Client side processing occurs when some programming code in an HTML
page is placed the client can understand. This code is simply HTML that the
browser executes. For example
<html>
<head>
<script language=”JavaScript”>
<! --
alert (“Hello World”);
-- >
</script>
<head>
<body>
Welcome to my page
</body>
5
</html>
If browser supports client side scripting, it will understand that line 5 is telling it
to display message box to the user saying “Hello World”.
So now we have two places to execute code: on the server, where everything
is returned to the clients as HTML, and on the client. These two locations of
code are distinct and cannot interact with each other. Table below outlines the
differences client-side and server-side code.
Location Description
Client-side This code isn’t processed at all by the
server. That’s solely the client
responsibility. Code is written in
scripts-plain text commands that
instruct the client to do something.
A Web application consists of three parts: content, program logic, and Web
configuration information. Table below summarizes these parts and gives
examples of where they reside in an ASP.NET Web application.
The Web form is the key element of a Web application. A Web form is a cross
between a regular HTML page and a Windows form: It has the same
appearance and similar behavior to an HTML page, but it also has controls
that respond to events and run code, like a Windows form.
When a user navigates to one of the Web Forms pages from his or her
browser, the following sequence occurs:
4. ASP.Net Architecture
<authentication mode="[Windows/Forms/Passport/None]">
<forms name="[name]" loginUrl="[url]" >
<credentials passwordFormat="[Clear, SHA1, MD5]">
<user name="[UserName]" password="[password]"/>
</credentials>
</forms>
<passport redirectUrl="internal" />
</authentication>
<authorization>
<allow users="[comma separated list of users]"
roles="[comma separated list of roles]"/>
<deny users="[comma separated list of users]"
roles="[comma separated list of roles]"/>
</authorization>
ASP.NET is an important part of the .NET Framework, but it is just one part.
Understanding what else the .NET Framework provides will help programming
ASP.NET application effectively and avoid writing new code to perform tasks
that are already implemented within the .NET Framework. First, a little
background. The .NET Framework is the new Microsoft programming platform
for developing Windows and Web software. It is made up of two parts:
.NET applications aren’t executed the same way as the traditional Windows
applications. Instead of being compiled into an executable containing native
code, .NET application code is compiled into Microsoft intermediate language
(MSIL) and stored in a file called an assembly. At run time, the assembly is
compiled to its final state by the CLR. While running, the CLR provides
memory management, type-safety checks, and other run-time tasks for the
application. Figure shows how this works
12
Applications that run under the CLR are called managed code because the
CLR takes care of many of the tasks that would have formerly been handled
in the application’s executable itself. Managed code solves the Windows
programming problems of component registration and versioning (sometimes
called DLL Hell) because the assembly contains all the versioning and type
information that the CLR needs to run the application. The CLR handles
registration dynamically at run time, rather than statically through the system
registry as is done with applications based on the Common Object Model
(COM).
The .NET class library provides access to all the features of the CLR. The
.NET class library is organized into namespaces. Each namespace contains a
functionally related group of classes. Table below summarizes the .NET
namespaces that are of the most interest to Web application programmers
namespaces. Each namespace contains a functionally related group of classes. Table below summarizes the .NET namespaces that ar
13
13131313131313†131381313138†1313l13SP.NET Pages
ASP.NET pages are simply pure text, like HTML files. Once a Web Server and
the .NET Framework SDK is set up and running, ASP.NET pages can be
created easily in ant text editor.
ASP.NET pages have the .aspx extension, so any files the server to interpret
as ASP.NET pages must end in .aspx such as default.aspx
Example
______________________________________________________________
1 <%@ Page Language="C#" %>
2
3 <script runat="server">
4 private void Page_Load (object sender, EventArgs e)
5 {
6 lblMessage.Text="Hello"+ tbMessage.Text;
7 }
8 </script>
9
10 <html>
11 <body>
12 <% Response.Write ("Our First Page");%>
13 <form runat="server">
14 Please enter your name:
15 <asp:textbox id="tbMessage" runat =server/>
16 <asp:button id="btSubmit" Text=Submit runat =server/>
14
This page highlights the most common elements found in ASP.NET pages. On
line 1 is <@ Page %> directive, which supplies the ASP.NET with specific
information that’s used during the compilation process. It is telling to ASP.NET
is C# programming language is used for writing code.
Lines 3-8 contain a block of code called a code declaration block. This is the
code ASP.NET uses to process its pages, it is compiled into MSIL
Starting on Line 10, HTML begins. This is the content that will be sent to the
browser. Line 12 begins with <% .This is known as a code render block. It
contains additional instructions that ASP.NET uses to produce output.
15
On Line 13 there is another traditional HTML element .but then there’s that
runat=”server” again. When this tag is specified the form becomes a Web
Form. Anything contained within a Web Form can be watched over by
ASP.NET
On lines 15, 16 17 we have few new elements that look like HTML elements,
these are known as Web controls.
As ASP.NET pages can be developed in any text editors but they don’t offer
many features that would make ASP.NET development easier.
Microsoft Visual Studio.NET (Integrated Development Environment) allows to
manage entire Web sites and it provides features such as deleting virtual
directories, working with database, and dragging and dropping HTML
components. It even color-codes ASP.NET code to make it easier to read.
(a)Classic ASP was built on top of the Windows operating system and IIS.It
was always a separate entity, and therefore its functionality was limited.
ASP.NET, on the other hand, is an integral part of the operating system under
the .NET Framework. It shares many of the same objects that traditional
applications would use, and all .NET objects are available for ASP. Net’s
consumption.
(b)ASP also made it clear that client and server were two separate entities.
Once ASP finished with work on the server, it passed the HTML to the client
and forgot about it.ASP.NET ties together the client and the server through
clever use of server –side code, all invisible to the developer.
all the developer need to be done is copy the DLL files. The .NET framework
handles everything else.
(b) Session management has become much easier and more powerful with
ASP.NET.It address this issue by providing built in session support that’s
scalable across Web Forms. It also provides reliability that can even survive
server crashes, and it can work with browser that doesn’t support cookies.
(c) In classic ASP, nearly all code was executed in code render blocks (that is
inside < %...%> tags).In ASP.NET, this type isn’t compiled and isn’t
recommended. Instead code declaration blocks, which are complied and
provide better performance. Using these blocks also avoids having code and
HTML interspersed throughout the page, which is very difficult to read through
an ASP page? Code declaration blocks can be placed right at the top of the
page in ASP.NET separated from the rest of the HTML.
• Mobile Web Device Support. ASP.NET Mobile Controls let easily target
cell phones, PDAs -- over 80 mobile Web devices -- using ASP.NET. A
developer write application just once and the mobile controls automatically
generate WAP/WML, HTML, or iMode as required by the requesting
device.
17
8. Conclusion
ASP.NET makes designing dynamic Web pages quicker and easier than ever
before. It is the next generation of Microsoft’s ASP, and provides many
enhancements to take advantage of new technology. With it, a developer can
interact with database, personalize Web pages for visitors, display pages on
mobile devices (such as cell phones), and even build an entire e-commerce
shopping site from scratch.
References
1. http://www.msdn.microsoft.com