Sie sind auf Seite 1von 19

1

SEMINAR REPORT

ON

ASP.NET
Contents 1. Introduction 2. Web Application Fundamentals 3. Parts of an ASP.NET Web Application 4. ASP.NET Architecture 5. The .NET Framework 6. Creation of ASP.NET Pages. 7. Comparison of ASP and ASP.NET 8. Conclusion

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. ASP.NET is a compiled, .NET-based environment; Developer can author applications in any .NET compatible language, including Visual Basic .NET, C#, and JScript .NET. Additionally, the entire .NET Framework is available to any ASP.NET application. Developers can easily access the benefits of these technologies, which include the managed common language runtime environment, type safety, inheritance, and so on. ASP.NET has been designed to work seamlessly with WYSIWYG HTML editors and other programming tools, including Microsoft Visual Studio .NET. Not only does this make Web development easier, but it also provides all the benefits that these tools have to offer, including a GUI that developers can use to drop server controls onto a Web page and fully integrated debugging support. 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 applications configuration, to name only a few possibilities.

Web Forms allows building powerful forms-based Web pages. When building these pages, ASP.NET server controls can be used to create common UI elements, and program them for common tasks. These controls allow to rapidly building a Web Form out of reusable built-in or custom components, simplifying the code of a page.

An XML Web service provides the means to access server functionality remotely. Using Web services, businesses can expose programmatic interfaces to their data or business logic, which in turn can be obtained and manipulated by client and server applications. XML Web services enable the exchange of data in client-server or server-server scenarios, using standards like HTTP and XML messaging to move data across firewalls. XML Web services are not tied to a particular component technology or object-calling convention. As a result, programs written in any language, using any component model, and running on any operating system can access XML Web services

2. Web Application Fundamentals


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 staticvisitors 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 client/server model. Although this is a marvelous way to communicate and distribute information, its rather simple and static. It cant provide any dynamic information or processing. The server simply waits around for someone t request information, and then it returns the data thats already stored on its hard drive without really looking at what its sending. Generally, static Web request follows these four steps:

1. The client locates a Web Server through www.microsoft.com). 2. The client requests page (such as index.htm). 3. The server sends the requested document. 4. The client receives the document and displays it.

its

URL

(such

as

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: 1. The client locates a Web Server through its URL (such as www.microsoft.com). 2. The client requests page (such as index.htm). 3. The server examines the requested file and processes any code it contains. 4. The server translates the results of the processing to HTML and sends the requested document to the client. 5. The client receives the document and displays it. Theres 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> </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.

5 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.

The differences between Client side and server side Location Client-side Description This code isnt processed at all by the server. Thats solely the client responsibility. Code is written in scripts-plain text commands that instruct the client to do something. Generally used for performing dynamic client effects, such as image rollovers or dynamic message boxes. This code is executed only on the server. Any content or information that this code produces must be converted to plain HTML before sent to the client. Code can be written in scripts as well, but ASP.net uses compiled languages. Used for processing returning data. content an

Server-side

3. Parts of an ASP.NET Web Application


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. Table: Parts of an ASP.NET Web Application Part Content Types of Files Description Web Forms, HTML, Content files determine images, audio, video, the appearance of a other data Web application. They can contain static text and images as well as elements that are composed on the fly by the program logic (as in the case of a database query). Executable files, scripts The program logic determines how the application responds to user actions. ASP.NET Web applications have a dynamic-link library (DLL) file that runs on the server, and they can also include scripts that run on the client machine.

Program Logic

7 Configuration Web configuration file, The configuration files Style sheets, IIS and settings determine settings how the application runs on the server, who has access, how errors are handled, and other details.

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. In a completed Web application, the executable portion of the Web form is stored in an executable (.dll) that runs on the server under the control of IIS. The content portion of the Web form resides in a content directory of the Web server, as shown in Figure

Web Application parts on a Web Server When a user navigates to one of the Web Forms pages from his or her browser, the following sequence occurs: IIS starts the Web applications executable if it is not already running. The executable composes a response to the user based on the content of the Web Forms page that the user requested and any program logic that provides dynamic content.

8 IIS returns the response to the user in the form of HTML. Once the user gets the requested Web form, he or she can enter data, select options, click buttons, and use any other controls that appear on the page. Some controls, such as buttons, cause the page to be posted back to the server for event processing and the sequence repeats itself, as shown in Figure

How the parts interact

4. ASP.Net Architecture

As the illustration shows, all Web clients communicate with ASP.NET applications through IIS. IIS deciphers and optionally authenticates the request. IIS also finds the requested resource (such as an ASP.NET application), and, if the client is authorized, returns the appropriate resource. Integrating with IIS IIS always assumes that a set of credentials maps to a Windows NT account and uses them to authenticate a user. There are three different kinds of authentication available in IIS 5.0: basic, digest, and Integrated Windows Authentication (NTLM or Kerberos). A developer can select the type of authentication to use in the IIS administrative services. If URL is requested containing an ASP.NET application, the request and authentication information are handed off to the application. ASP.NET provides the two additional types of authentication described in the following table ASP.NET authentication provider Forms authentication Description A system by which unauthenticated requests are redirected to an HTML form using HTTP client-side redirection. The user provides credentials and submits the form. If the application authenticates the request, the system issues a form that contains the credentials or a key for reacquiring the identity. Subsequent requests are issued with the form in the request headers; they are authenticated and authorized by an ASP.NET handler using whatever validation method the application developer specifies. Centralized authentication service provided by Microsoft that offers a single log on and core profile services for member sites.

Passport authentication

10 Using ASP.NET Configuration Files ASP.NET configuration, of which security is a part, has a hierarchical architecture. All configuration information for ASP.NET is contained in files named Web.config and Machine.config. Web.config can be placed in the same directories as the application files. The Machine.config file is in the Config directory of the install root. Subdirectories inherit a directory's settings unless overridden by a Web.config file in the subdirectory. In a Web.config file, there are sections for each major category of ASP.NET functionality. The security section of a Web.config file is organized as follows:
<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> <identity impersonate ="[true/false]"/>

5. The .NET Framework

11 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:

An execution engine called the common language runtime (CLR) A class library that provides core programming functions, such as those formerly available only through the Windows API, and application-level functions used for Web development (ASP.NET), data access (ADO.NET), security, and remote management

.NET applications arent 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

How a .NET application runs 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

12 in the applications 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 A Summary of the .NET Framework Class Library
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 programmersCategory Namespaces Provides Classes for

Common Types

System

All the common data types, including strings, arrays, and numeric types. These classes include methods for converting types, for manipulating strings and arrays, and for math and random number tasks.

Data Access

System.Data, System.Data.Common, System.Data.OleDb, System.Data.SqlClient, System.Data.SqlTypes

Accessing databases. These classes include methods for connecting to databases, performing commands, retrieving data, and modifying data

Debugging

System.Diagnostics

Debugging and tracing application execution.

File Access

System.IO, System.IO.IsolatedStora ge, System.DirectoryService

Accessing the file system. These include methods for reading and writing files and getting paths and

13
s filenames.

Network Communication

System.Net, System.Net.Sockets

Security

System. Security, System.Security.Cryptog raphy, System.Security.Permiss ions, System.Security.Policy, System.Web.Security

Communicating over the Internet using low-level protocols such as TCP/IP. These classes are used when creating peer-to-peer applications Providing user authentication, user authorization, and data encrypting

Web Applications

Web Services

System. Web, System.Web.Caching, System.Web.Configurati on, System.Web.Hosting, System.Web.Mail, System.Web.SessionStat e, System.Web.UI, System.Web.UI.Design, System.Web.UI.WebCon trols, System.Web.UI.HtmlCon t System.Web.Services, System.Web.Services.C onfiguration, System.Web.Services.D escription, System.Web.Services.Di scovery, System.Web.Services.Pr otocols

Creating client-server applications that run over the Internet. These are the core classes used to create ASP.NET Web applications

Creating co135@

and

publishing

1313 13131313131313131313131313 8m131313bjbj221313131313131 31313131313131313131313 13 13X1313X1313 e1 313131313131313131313131313 131313131313131313131313131 313131313131313131313 131313131313131313131313 13131313131313131313131313 13131313131313131313131313 131313131313131313131313 1313131313131313131313131 3131313131313131313131313 13131313131313131313131313 1313131313131313131381313 1381313l13135@ 1313 13131313131313131313131313 8m131313bjbj221313131313131 31313131313131313131313 13 13X1313X1313 e1 313131313131313131313131313 131313131313131313131313131

14
414141414141414141414 141414141414141414141414 14141414141414141414141414 14141414141414141414141414 1414141414141414141414141 4141414141414141414141414 1414141414141414141414141 41414141414141414141414141 4

141414141414141414814141481414l14SP.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/> 17 <asp:Label id= "lblMessage" runat="server" /> 18 </form> 19 </body> 20 </html> ______________________________________________________________ This page is saved as Sample.aspx in virtual directory of IIS. (default is c:\intetpub\wwwroot\sample.aspx),it can be viewed with the URL http://localhost/sample.aspx.Entering the Name in the textbox and clicking Submit a hello message is shown as in figure.

15

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 thats 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. On Line 13 there is another traditional HTML element .but then theres 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 dont 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.

16

7. Comparison of ASP and ASP.NET


ASP.NET is a complete overhaul of traditional Active Server Pages .It offers a very different methodology for building Web Applications. Some of the general differences between ASP and ASP.NeT are as follows: 1. Fundamental Changes from ASP (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. Nets 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. (c) Furthermore, ASP.NET code is compiled, whereas classic ASP used interpreted scripting languages. Using compiled means an automatic boost in performance over ASP applications. 2. Programmatic Enhancements over ASP (a) One of the biggest enhancements in ASP.NET is its ease of deployment, the metadata stores all necessary information for applications, so there is no need to register Web applications or COM objects. When deploying classic ASP applications, it is needed to copy appropriate DLLs and use REGSVR32.EXE to register the components. With ASP.NET 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 thats scalable across Web Forms. It also provides reliability that can even survive server crashes, and it can work with browser that doesnt support cookies. (c) In classic ASP, nearly all code was executed in code render blocks (that is inside < %...%> tags).In ASP.NET, this type isnt compiled and isnt 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.

17

3. Difference in Programming Methodologies ASP.NET is now completely object oriented. Classic ASP strove to introduce the concept of object-oriented programming (OOP), but was unable to because that was a fundamentally different programming paradigm. Further Developer can author applications in any .NET compatible language, including Visual Basic .NET, C#, and JScript .NET. 4. New Application Models ASP.NET extends applications reach to new customers and partners. XML Web Services. XML Web services allow applications to communicate and share data over the Internet, regardless of operating system or programming language. ASP.NET makes exposing and calling XML Web Services simple.

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.

18

8. Conclusion ASP.NET makes designing dynamic Web pages quicker and easier than ever before. It is the next generation of Microsofts 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. ASP.NET is an exciting new Web development technology that is going to take the world by storm. This next generation of Web Development technology make designing impressive Web sites an easy and fun process. ASP.NET has many advantages over other platforms when it comes to creating Web applications. Probably the most significant advantage is its integration with the Windows server and programming tools. Web applications created with ASP.NET are easier to create, debug, and deploy because those tasks can all be performed within a single development environmentVisual Studio .NET.

19

References 1. http://www.msdn.microsoft.com 2. Microsoft .NET framework SDK Documentation. 3. Developing Web Applications with Microsoft Visual Basic.NET and Visual C#.NET by Microsoft Corporation.

Das könnte Ihnen auch gefallen