Focus on Microsoft Technologies - Tutorials, Articles, Code Samples.

Friday, October 06, 2006

Introduction to ASP.NET

ASP.NET – Introduction

What is ASP?

Before getting into knowing the 2.0, we shall spend sometime understanding from where this started – ASP (Active Server Pages) is a Microsoft Technology. ASP is a server side scripting technology that enables scripts (embedded in web pages) to be executed by an Internet server.

An ASP file is just the same as an HTML file that can contain text, HTML, XML, and scripts. Scripts are grouped into Client Side and Server Side scripts. These scripts can be written using various scripting languages and the most commonly used where Jscript / JavaScript for Client Side and vbScript for Server Side scripts. The client side scripts are executed at the browser end while the Server Side Scripts are executed on the Web Server. An ASP file has the file extension ".asp"

How Does it work:

When you type a link and click go on the Web Browser (WB), the WB sends the request to the respective Web Server and gets back the page. If the page requested is an htm/html page, they will be returned by the web server directly without any processing. Htm/Html files are static files.

When a browser requests an ASP file, IIS passes the request to the ASP engine on the server. The ASP engine reads the file, line by line, and executes the Server Side scripts in the file and finally, the ASP file is returned to the browser as plain HTML.


ASP has gone through a serious of versions before coming to .net platform where it is currently in Ver 2.0. It started from ASP, ASP 2.0, ASP 3.0 and ASP+ which was the same as ASP.NET. ASP+ is just an early name used by Microsoft when they developed ASP.NET.

What is ASP.NET?

ASP.NET is the next generation ASP, but it's not an upgraded version of ASP. ASP.NET is an entirely new paradigm for server-side ASP scripting. From not just scripting langages but normal languages like C#, VB and all other languages supported by .net was supported.

ASP.NET is a part of the .NET Framework. Microsoft spent three years rewriting ASP.NET from the ground up, and ASP.NET is not fully backward compatible with ASP 3.0.

.NET Framework

The .NET Framework is the infrastructure for the Microsoft .NET platform. It is an environment for building, deploying, and running solutions from Microsoft.

The .NET Framework contains a common language runtime and common class libraries - like ADO.NET, ASP.NET and Windows Forms - to provide advanced standard services that can be integrated into a variety of computer systems. It provides a feature-rich application environment, simplified development and easy integration between a number of different development languages. It is language neutral. It supports C++, C#, Visual Basic, JScript and a host of other languages.

Advantages Using ASP.NET

  • <!--[if !supportLists]-->Reduces the amount of code required to build large applications
  • Makes development simpler and easier to maintain with an event-driven, server-side programming model
  • Easy to write and maintain since the source code and HTML are together
  • The source code is executed on the server it provides lots of power and flexibility through this approach.
  • The source code is compiled the first time the page is requested. Execution is fast as the Web Server compiles the page the first time it is requested. The server saves the compiled version of the page for use next time the page is requested
  • The HTML produced by the ASP.NET page is sent back to the browser. The application source code you write is not sent and is not easily stolen
  • Easy deployment. There is no need to register components since the configuration information is built-in.
  • The Web server continuously monitors the pages, components and applications running on it. If it notices memory leaks, infinite loops, other illegal software or activities, it seamlessly kills those activities and restarts itself
  • Provides controls for Creating Rich UI, Validation, Authentication, Data Binding etc, with little code to write.
  • ASP.NET applications run faster and caters for large volumes of users without performance problems

ASP.NET Features

ASP.NET combines unmatched developer productivity with performance, reliability, and deployment. Below are the list features:

Easy Programming Model

It makes building real world Web applications dramatically easier. Server controls enable an HTML-like style of declarative programming that let you build great pages with far less code. Displaying data, validating user input, and uploading files are all amazingly easy. Best of all, ASP.NET pages work in all browsers including Netscape, Opera, AOL, and Internet Explorer.

Flexible Language Options

It lets you leverage your current programming language skills. It support more than all .NET languages (around 25, mostly used VB.NET, C#, and JScript.NET), giving you unprecedented flexibility in your choice of language.

Great Tool Support applications can be built using any text editor, even Notepad. But Visual Studio .NET provides Visual Basic-style of development to the Web. Now you can visually design ASP.NET Web Forms using familiar drag-drop-double click techniques, and enjoy full-fledged code support including statement completion and color-coding. VS.NET also provides integrated support for debugging and deploying ASP.NET Web applications. The Enterprise versions of Visual Studio .NET deliver life-cycle features to help organizations plan, analyze, design, build, test, and coordinate teams that develop ASP.NET Web applications. These include Class modeling, DB modeling (Logical & Physical models), Testing tools (functional, performance and scalability).

Rich Class Framework

The .NET Framework offers over rich set of classes that encapsulate rich functionality like XML, data access, file upload, regular expressions, image generation, performance monitoring and logging, transactions, message queuing, SMTP mail, and much more. With Improved Performance and Scalability ASP.NET lets you use serve more users with the same hardware.

Compiled execution

No explicit compilation steps are required. ASP.NET will automatically detect any changes, dynamically compile the files if needed, and store the compiled results to reuse for subsequent requests. Dynamic compilation ensures that your application is always up to date, and compiled execution makes it fast.

Rich Caching

Caching is used to retain pages or data across HTTP requests and reuse them without the expense of recreating them.

ASP.NET has three kinds of caching that can be used by Web applications:

  • <!--[if !supportLists]--> <!--[endif]-->Output caching, which caches the dynamic response generated by a request.
  • <!--[endif]-->Fragment caching, which caches portions of a response generated by a request.
  • <!--[endif]-->Data caching, which caches arbitrary objects programmatically. To support this, ASP.NET provides a full-featured cache engine that allows programmers to easily retain data across requests.

Output caching is useful when the contents of an entire page can be cached. On a heavily accessed site, caching frequently accessed pages for even a minute at a time can result in substantial throughput gains. While a page is cached by the output cache, subsequent requests for that page are served from the output page without executing the code that created it.

Sometimes it is not practical to cache an entire page - perhaps portions of the page must be created or customized for each request. In this case, it is often worthwhile to identify objects or data that are expensive to construct and are eligible for caching. Once these items are identified, they can be created once and then cached for some period of time. Additionally, fragment caching can be used to cache regions of a page's output.

Choosing the time to cache an item can be an interesting decision. For some items, the data might be refreshed at regular intervals or the data is valid for a certain amount of time. In that case, the cache items can be given an expiration policy that causes them to be removed from the cache when they have expired. Code that accesses the cache item simply checks for the absence of the item and recreates it, if necessary.

The ASP.NET cache supports file and cache key dependencies, allowing developers to make a cache item dependent on an external file or another cache item. This technique can be used to invalidate items when their underlying data source changes.

Enhanced Reliability & Performance

ASP.NET ensures that your application is always available to your users.

It provides a number of built-in performance enhancements. For example, pages are compiled only once and cached for subsequent requests. Because these compiled pages are saved to disk, even a complete server restart does not invalidate them. It also caches internal objects, such as server variables, to speed user code access. Further, it benefits from all of the performance enhancements to the common language runtime: just-in-time compiling, a fine-tuned common language runtime for both single- and multiprocessor computers, and so on.

ASP.NET automatically detects and recovers from errors like deadlocks and memory leaks to ensure your application is always available to your users. For example, say that your application has a small memory leak, and that after a week the leak has tied up a significant percentage of your server's virtual memory. ASP.NET will detect this condition, automatically start up another copy of the ASP.NET worker process, and direct all new requests to the new process. Once the old process has finished processing its pending requests, it is gracefully disposed and the leaked memory is released. Automatically, without administrator intervention or any interruption of service, ASP.NET has recovered from the error.

Easy Deployment

ASP.NET takes the pain out of deploying server applications. "No touch" application deployment. ASP.NET dramatically simplifies installation of your application. With ASP.NET, you can deploy an entire application as easily as an HTML page, just copy it to the server. No need to register any components and configuration settings are stored in an XML file within the application.

Easy Migration Path

You don't have to migrate your existing applications to start using ASP.NET. ASP.NET runs on IIS side-by-side with classic ASP. Your existing ASP applications continue to be processed by ASP.DLL, while new ASP.NET pages are processed by the new ASP.NET engine. You can migrate application by application, or single pages. And ASP.NET even lets you continue to use your existing classic COM business components.

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. Any class can be converted into an XML Web Service with just a few lines of code, and can be called by any SOAP client. Likewise, ASP.NET makes it incredibly easy to call XML Web Services from your application. No knowledge of networking, XML, or SOAP is required.

Mobile Web Device Support

ASP.NET Mobile Controls let you easily target cell phones, PDAs and a vast array of mobile Web devices. You write your application just once, and the mobile controls automatically generate WAP/WML, HTML as required by the requesting device.

Post a Comment