Web Application Fundamentals 8. Conclusion: Seminar Report
Web Application Fundamentals 8. Conclusion: Seminar Report
Web Application Fundamentals 8. Conclusion: Seminar Report
com
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
www.Fullinterview.com
www.Fullinterview.com
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.
www.Fullinterview.com
www.Fullinterview.com
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
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 www.Fullinterview.com
www.Fullinterview.com
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> www.Fullinterview.com
www.Fullinterview.com
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.
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
www.Fullinterview.com
www.Fullinterview.com
www.Fullinterview.com
7 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.
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
www.Fullinterview.com
www.Fullinterview.com
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. 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
www.Fullinterview.com
www.Fullinterview.com
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
www.Fullinterview.com
10 provided by Microsoft that offers a single log on and core profile services for member sites.
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]"/>
www.Fullinterview.com
www.Fullinterview.com
11
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
www.Fullinterview.com
www.Fullinterview.com
12
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 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
namespaces. Each namespace contains a functionally related group of classes. Table below summarizes the .NET namespaces that ar
www.Fullinterview.com
www.Fullinterview.com
13
131313131313131313813131381313l13SP.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/> www.Fullinterview.com
www.Fullinterview.com
14
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.
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.
www.Fullinterview.com
www.Fullinterview.com
15
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.
www.Fullinterview.com
16
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.
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.
www.Fullinterview.com
www.Fullinterview.com
17
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.
www.Fullinterview.com
www.Fullinterview.com
18
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.
www.Fullinterview.com