My Profile
Active Members
TodayLast 7 Days
more...
Awards & Gifts
Online Exams
Fresher Jobs
Our fresher job section is exclusively for fresh graduates! Find jobs for freshers in major Indian
cities including Bangalore, Chennai, Hyderabad, Pune or Kochi
Resources
Find educational articles, blogs, discussion threads and other resources.
Colleges
Find details about any college in India or search for courses.
Paid Surveys
|
INTRODUCTION TO ASP.NET
Posted Date: 21 May 2008 Resource Type: Articles/Knowledge Sharing Category: Computer & Technology
|
Posted By: mohit Member Level: Gold Rating: Points: 1
|
|
|
|
Introduction to ASP.NET: ASP.NET is a technology that allows us to build and control dynamic Web pages easily. It also provides many enhancements to take advantage of new technology as we can interact with databases, personalize Web pages for visitors, display page on mobile devices (such as cell phones), and even build an entire e-commerce site from scratch. Previously internet works on request/response model that is an integral part of client/server model. Although this is a marvelous way of communicate and distribute information, it's rather simple and static. When the process is over, once client receives the requesting page from the server the server has no idea what the client is doing unless it makes another request. There is another model for communicating between server and clients, known as event-driven model.ASP.NET work on this model, it detects action and responds to them i.e. the server waits around for something to happen on the client. Once it does, the server takes action and performs some piece of functionality. Of course, a Web, server can not know what you are thinking, but it can respond to your actions. If you type some text on Web page, the server responds to it. If you click an image, the server responds.
|
Responses
|
| Author: mohit 21 May 2008 | Member Level: Gold Points : 2 | COMPARISON OF ASP AND ASP.NET:
? Classic ASP was built on the top of the Windows operating system and IIS (Internet Information Server). It was always a separate entity, and therefore its functionality was limited. ASP.NET, on the other hand, is an integral part of the system under the .NET Framework. It shares many 9f the same objects that traditional applications would use and all .NET objects available for ASP. NET consumption. ? Instead of being limited to six inherent objects in ASP, ASP.NET has a plethora of useful components it can build form. ? ASP also made it abundantly clear that client and server were two separate entities, Whereas ASP. NET ties together the client and the server through clever use of server-side and client-side code, all invisible to the developer. ? ASP.NET code is compiled, whereas classic ASP used interpreted scripting languages. Using compiled code means an automatic boost in performance over ASP applications. ? In classic ASP, nearly all of the code was executed in code render blocks (that is, inside <%...%> tags). In ASP.NET, this type of code isn’t compiled and isn’t recommended for frequent use. Instead, you use the code declaration blocks, which are compiled and provide better performance.
| | Author: mohit 21 May 2008 | Member Level: Gold Points : 2 | Following are some of the significant new features of ASP.NET: ? ASP.NET uses compiled code written in Common Language Runtime languages such as Visual Basic and C#. Unlike previous versions of Active Server Pages, this version does not use interpreted scripting languages such as VBScript. ? ASP.NET pages are built out of server-side controls. Web server controls enable you to represent and program against Hypertext Markup Language (HTML) elements using an intuitive object model. ? ASP.NET includes a new technology called Web Services. You can use Web Services to access methods and properties and transfer database data across the Internet. ? ASP.NET is part of Microsoft's .NET Framework. You can access thousands of .NET classes in your code that enable you to perform such wondrously diverse tasks as generating images on-the-fly and saving an array to a file. ? ASP.NET includes page and data caching mechanisms that enable you to easily and dramatically improve the performance of your Web site.
| | Author: mohit 21 May 2008 | Member Level: Gold Points : 2 | What is ASP.NET? This may seem like a relatively simple question, but I assure you that it's not. Because ASP.NET is part of the .NET framework, it is available on any server with the framework installed. In other words, it's not an add-on anymore; ASP has become legitimate. ASP.NET is implemented in an assembly that exposes classes and objects that perform predetermined specific tasks. If you are familiar with "classic" ASP (the versions of ASP that preceded .NET), you'll find that your approach to programming in ASP.NET is somewhat different, but the concepts behind building a Web application are much the same. If you're not familiar with classic ASP, so much the better— you won't have as much information to forget! ASP.NET programs are centralized applications hosted on one or more Web servers that respond dynamically to client requests. The responses are dynamic because ASP.NET intercepts requests for pages with specific extensions, for example .aspx or .ascx, and hands off the responsibility for answering those requests to just-in-time (JIT) compiled code files that can build a response on-the-fly. (web.config and machine.config) files, Web Services (ASMX) files, and Web Forms (ASPX) files. The server doesn't "serve" any of these file types— it returns the appropriate content type to the client. The configuration file types contain initialization and settings for a specific application or portion of an application. Another configuration file, called machine.web, contains machine-level initialization and settings. The server ignores requests for Web files, because serving them might constitute a security breach. This book concentrates on Web Forms and Web Services. Client requests for those file types cause the server to load, parse, and execute code to return a dynamic response. For Web Forms, the response usually consists of HTML or WML. For Web Services, the server typically creates a Simple Object Access Protocol (SOAP) response. While SOAP requests are inherently stateless and can thus execute immediately, Web Forms are stateful by default. Web Forms maintain state by round-tripping user interface and other persistent values between the client and the server automatically for each request. It is possible (but not the default) to take advantage of ASP.NET's state maintenance architecture from a Web Service, but for performance reasons, you should generally avoid doing so. Both Web Forms and Web Services requests can take advantage of ASP.NET's integrated security and data access through ADO.NET and can run code that uses system services to construct the response. The major difference between a static request and a dynamic request is that a typical Web request references a static file. The server reads the file and responds with the contents of the requested file. With ASP.NET there's no such limitation. You don't have to respond with an existing file— you can respond to a request with anything you like, including dynamically created HTML, Extensible Markup Language (XML), graphics, raw text, or binary data— anything. Capability, by itself, is nothing new— you've been able to create CGI programs, JavaServer Pages, classic ASP pages, ColdFusion, and Net- Objects Fusion pages for quite some time. All these technologies give you the capability to respond to an HTTP request dynamically. So what are the differences? n Unlike classic ASP, ASP.NET uses .NET languages. Therefore, you have access to the full power of any .NET assembly or class in exactly the same way as you do from any other Windows application written in C#. In this sense, ASP.NET is similar to early compiled CGI programs, but with CGI, a separate copy of the program had to be loaded and executed for each request. ASP.NET code exists in multithreaded JIT-compiled DLL assemblies, which can be loaded on demand. Once loaded, the ASP.NET DLLs can service multiple requests from a single in-memory copy. n ASP.NET supports all the .NET languages (currently C#, C++, VB.NET, and JScript, but there are well over 20 different languages in various stages of development or deployment for .NET), so you will eventually be able to write Web applications in your choice of almost any modern programming language. In addition, there are open source groups working with Intel and Hewlett-Packard to support .NET on various flavors of Unix and Linux. JavaServer Pages support only Java, but because Java now has a wide support base, that's not much of a limitation. Java Servlets are more like ASP.NET but offer little support for state maintenance, Web Services, or XML. In addition, no Java design environment competes in features and quality to Visual Studio. n Classic ASP supported several scripting languages, although in practice, VBScript and JScript were by far the most prevalent. Although the scripting languages you could use with classic ASP were untyped, interpreted, and not particularly powerful, you could extend ASP's basic functionality by writing DLLs in any COM-compliant language. Another ASP.NET competitor, ColdFusion, uses ColdFusion Markup Language (CFML) tags, which have a powerful but limited set of capabilities; however, you can extend CFML with custom programming in C++ or Java. n Microsoft was able to draw on millions of hours of developer experience with classic ASP, so in addition to huge increases in speed and power, ASP.NET provides substantial development improvements, such as seamless server-to-client debugging, automatic validation of form data, and a programming model very similar to that of a Windows application.
| | Author: mohit 21 May 2008 | Member Level: Gold Points : 2 | Framework for Processing HTTP Requests
Microsoft's Web server, Internet Information Server (IIS), handles HTTP requests by handing off the request to the appropriate module based on the type of file requested. Note that IIS responds with one of only a few possible actions when it receives a request. Respond with the File's Contents The server locates and reads the requested file's contents and then streams the contents back to the requester. The server responds in this manner to .htm and .html file requests, as well as to all requests that have no associated application type— for example, EXE files. Respond by Handing Off the Request The server hands off requests for files that end in .asp to the classic ASP processor and files that end in .aspx, .ascx, or .asmx to the ASP.NET processor. Respond with an Error IIS responds with a customizable error message when a requested file does not exist, when the requesting client has insufficient permissions to authenticate or access the resource, or when an error occurs during processing. Using the Internet Services Manager, you can change IIS's response to any particular file extension. For example, you could have the ASP.NET engine handle all requests for files with .htm or .html extensions, or you can create your own extensions and assign an action to them.
| | Author: mohit 21 May 2008 | Member Level: Gold Points : 2 | What is ASP.NET? This may seem like a relatively simple question, but I assure you that it's not. Because ASP.NET is part of the .NET framework, it is available on any server with the framework installed. In other words, it's not an add-on anymore; ASP has become legitimate. ASP.NET is implemented in an assembly that exposes classes and objects that perform predetermined specific tasks. If you are familiar with "classic" ASP (the versions of ASP that preceded .NET), you'll find that your approach to programming in ASP.NET is somewhat different, but the concepts behind building a Web application are much the same. If you're not familiar with classic ASP, so much the better— you won't have as much information to forget! ASP.NET programs are centralized applications hosted on one or more Web servers that respond dynamically to client requests. The responses are dynamic because ASP.NET intercepts requests for pages with specific extensions, for example .aspx or .ascx, and hands off the responsibility for answering those requests to just-in-time (JIT) compiled code files that can build a response on-the-fly. (web.config and machine.config) files, Web Services (ASMX) files, and Web Forms (ASPX) files. The server doesn't "serve" any of these file types— it returns the appropriate content type to the client. The configuration file types contain initialization and settings for a specific application or portion of an application. Another configuration file, called machine.web, contains machine-level initialization and settings. The server ignores requests for Web files, because serving them might constitute a security breach. This book concentrates on Web Forms and Web Services. Client requests for those file types cause the server to load, parse, and execute code to return a dynamic response. For Web Forms, the response usually consists of HTML or WML. For Web Services, the server typically creates a Simple Object Access Protocol (SOAP) response. While SOAP requests are inherently stateless and can thus execute immediately, Web Forms are stateful by default. Web Forms maintain state by round-tripping user interface and other persistent values between the client and the server automatically for each request. It is possible (but not the default) to take advantage of ASP.NET's state maintenance architecture from a Web Service, but for performance reasons, you should generally avoid doing so. Both Web Forms and Web Services requests can take advantage of ASP.NET's integrated security and data access through ADO.NET and can run code that uses system services to construct the response. The major difference between a static request and a dynamic request is that a typical Web request references a static file. The server reads the file and responds with the contents of the requested file. With ASP.NET there's no such limitation. You don't have to respond with an existing file— you can respond to a request with anything you like, including dynamically created HTML, Extensible Markup Language (XML), graphics, raw text, or binary data— anything. Capability, by itself, is nothing new— you've been able to create CGI programs, JavaServer Pages, classic ASP pages, ColdFusion, and Net- Objects Fusion pages for quite some time. All these technologies give you the capability to respond to an HTTP request dynamically. So what are the differences? n Unlike classic ASP, ASP.NET uses .NET languages. Therefore, you have access to the full power of any .NET assembly or class in exactly the same way as you do from any other Windows application written in C#. In this sense, ASP.NET is similar to early compiled CGI programs, but with CGI, a separate copy of the program had to be loaded and executed for each request. ASP.NET code exists in multithreaded JIT-compiled DLL assemblies, which can be loaded on demand. Once loaded, the ASP.NET DLLs can service multiple requests from a single in-memory copy. n ASP.NET supports all the .NET languages (currently C#, C++, VB.NET, and JScript, but there are well over 20 different languages in various stages of development or deployment for .NET), so you will eventually be able to write Web applications in your choice of almost any modern programming language. In addition, there are open source groups working with Intel and Hewlett-Packard to support .NET on various flavors of Unix and Linux. JavaServer Pages support only Java, but because Java now has a wide support base, that's not much of a limitation. Java Servlets are more like ASP.NET but offer little support for state maintenance, Web Services, or XML. In addition, no Java design environment competes in features and quality to Visual Studio. n Classic ASP supported several scripting languages, although in practice, VBScript and JScript were by far the most prevalent. Although the scripting languages you could use with classic ASP were untyped, interpreted, and not particularly powerful, you could extend ASP's basic functionality by writing DLLs in any COM-compliant language. Another ASP.NET competitor, ColdFusion, uses ColdFusion Markup Language (CFML) tags, which have a powerful but limited set of capabilities; however, you can extend CFML with custom programming in C++ or Java. n Microsoft was able to draw on millions of hours of developer experience with classic ASP, so in addition to huge increases in speed and power, ASP.NET provides substantial development improvements, such as seamless server-to-client debugging, automatic validation of form data, and a programming model very similar to that of a Windows application.
| | Author: mohit 21 May 2008 | Member Level: Gold Points : 2 | Why Do You Need ASP.NET? The first computer languages were little more than mnemonics substituting for raw machine code instructions, but as computers became more complex, each new language generation has supported an increasing level of abstraction. Visual Basic, for example, abstracted user interface design and construction into simple drag-and-drop operations (a model that VS.NET extends to all .NET-compliant languages). For the first time, you could create a working Windows application with very little effort. Similarly, when Web programming first became widespread, there were few tools to help programmers write Web applications. To create a Web application, you initially had to write low-level socket communications code. Over the years, the abstraction level has increased for Web programming as well. First Common Gateway Interface (CGI) let you create executables that handled requests. Next, the Internet Server API (ISAPI) and its counterpart NSAPI (Netscape Server API) let you intercept requests and serve them from in-memory code components (DLLs), which was much faster. An ISAPI module, in turn, could host a scripting engine, a combination that became the basis for classic ASP and proved to be extremely popular with programmers. Microsoft extended the power of scripting language Web programming in classic ASP by providing several "intrinsic" objects. These represented the request, the server's response, the server itself, the user's session, and the "application." All together, they simplified and automated the process of parsing and encrypting the request and response data and made it easier to maintain global values and data for individual clients. ASP.NET is the latest (and arguably the best) of these abstractions because it lets you work almost exclusively with rich high-level classes and objects rather than directly with raw data. Without ASP.NET, building a Web application is a chore. With ASP.NET, building a Web application is similar to building a Win32 application.
| | Author: mohit 21 May 2008 | Member Level: Gold Points : 2 | WHATS NEW IN ASP.NET
Client Changes ASP.NET lets you build Web-based applications that interact with pages displayed remotely. Originally, classic ASP was designed to work with browsers, which at that time were capable of little more than displaying data and images wrapped in HTML markup. While the integration hasn't changed, the clients have changed dramatically. For example, modern browsers are much more capable than the version 3 browsers available when classic ASP was first developed. Not only can they display HTML and images, they also support Cascading Style Sheets (CSS), Dynamic HTML (DHTML), XML (to varying degrees), animations, complex image effects, vector graphics, sound, and video— and can run code, letting you offload appropriate portions of your application's processing requirements from your server to the client.
Centralized Web-Based Applications It's not only browsers that have changed. Centralized Web-based applications have garnered a huge investment from companies that increasingly need to support mobile and remote clients. The cost of supplying private network connectivity to such clients is prohibitive, yet the business advantages of supporting such clients continue to rise. The only cost-effective way to supply and maintain corporate applications to these mobile and remote workers is to uncouple them from the network and build the applications to work over the public Internet via HTTP, WAP, and other advanced protocols. Therefore, Web-based applications are no longer the exclusive purview of Webmasters and specialist developers; they've become an integral part of the corporate IT operations.
Distributed Web-Based Applications For all the advantages of centralized Web applications, they mostly ignore a huge reservoir of processing power that exists on the client machines. Recently, a new breed of application has begun to attract attention— the point-to-point program (often abbreviated as "P-to-P" or "P2P"). These programs typically use XML to pass messages and content directly from one machine to another. Most current implementations, such as Groove and Napster, use a centralized server as a directory service that helps individuals or machines contact one another. Peer-to-peer applications are often called distributed because the application runs at many points on the network simultaneously. In addition, the data used by distributed applications is usually (but not necessarily) stored in multiple locations. Finally, applications have begun to appear that run on multiple clients simultaneously, taking advantage of the enormous amount of unused processing power that exists on the "edge" of the Web. Unlike standard applications, no one machine has to have the entire application; instead, each client processes data as requested and coordinated from a central server— in other words, the application uses the edge machines as nothing more than an extra CPU.
Functional Interoperability As the client transition from stand-alone applications to browser-based interfaces occurred, another factor came into play: interoperability. IT departments have struggled with interoperability ever since programming escaped the confines of the mainframe. As the number of computers and computing devices within the business and entertainment worlds expanded, the problem grew. Today, computing is no longer limited to full-size desktop machines or even laptops. Handheld and notepad computers, telephones, and even pagers communicate with the Web servers and need to display data— sometimes even display the same data or run the same application as a desktop box. Similarly, IT departments now run critical applications on mainframes, minicomputers, and several different types of servers, from small departmental servers to server farms that supply computing power to the entire enterprise and beyond. These servers are made by different vendors and often run differing and incompatible operating systems, yet companies often need to transport and consume data between the various machines, databases, application tiers, and clients. Companies have attacked the interoperability problem in several ways. They've tried limiting the hardware and software— creating tight corporate standards for desktop, laptop, and handheld computers. That approach hasn't worked very well— the industry changes too fast. They've tried and discarded the thin-client network computer approach. Too little benefit, too late. They've tried implementing Java as both the platform and the language— but performance issues, a lack of cooperation between the major software suppliers, and the lack of commercial-quality software have— at least temporarily— quelled that approach as well. Fortunately, a new interoperability standard has recently presented itself:
Extensible Markup Language (XML). Standardization, Verifiability, and HTTP Affinity XML provides a possible solution to some of these interoperability problems. XML is not a panacea, but it does provide a standardized and verifiable text-based file format that can help ease the problems involved in moving data from one server to another, as well as accommodate displaying identical data on disparate clients. XML's standardization helps because the file format is universally recognized. XML simplifies programming because it can verify, by using a document type definition (DTD) or schema, that a file does indeed contain a specific type of content. Finally, XML's text-based format transfers very well over a plain HTTP connection, which helps avoid problems with firewalls and malicious code.
Web Services These attributes— standardization, verifiability, and HTTP affinity— led to a new use for ASP: creating server-based code that delivers data without necessarily delivering HTML. In .NET, such pages are called Web Services. You can think of a Web Service as a function call or as an object instantiation and method call across the Web. Just as Web browsers and Web servers use a common protocol— HTTP— to communicate across the network, a Web Service uses a common XML structure called Simple Object Access Protocol (SOAP) to communicate with the calling application.
| | Author: mohit 21 May 2008 | Member Level: Gold Points : 2 | What Does ASP.NET Do? What does ASP.NET do? Again, this is not a simple question. Classic ASP was limited to simple script languages that could respond to requests but provided no intrinsic direct access to system services other than those few required to read and respond to a request, such as writing output text. Although you could extend classic ASP through commercial or custom-built COM components, the relatively high overhead required to create COM objects and classic ASP's reliance on untyped interpreted scripting languages limited system performance. In contrast, creating .NET framework objects requires very little overhead, and ASP.NET lets you use fully object-oriented languages with seamless access to system services. Therefore, I'll describe just the primary tasks that ASP.NET accomplishes now, and I'll fill in the practical details in the remainder of this book. Accepts Requests All ASP.NET pages work essentially the same way. A client application makes an HTTP request to a Web server using a URL. The Web server hands off the request to the ASP.NET processor, which parses the URL and all data sent by the client into collections of named values. ASP.NET exposes these values as properties of an object called the HttpRequest object, which is a member of the System.Net assembly. An assembly is a collection of classes. Although an assembly can be a DLL, it may consist of more than one DLL. Conversely, a single DLL may contain more than one assembly. For now, think of an assembly as a group of related classes. When a browser, or more properly a user agent, makes a request, it sends a string containing type and version information along with the request. You can retrieve the HTTP_USER_AGENT string via the HttpRequest object. For example, the following code fragment retrieves several items from the user agent and writes them back to the client. An ASP.NET Web Form Page object exposes the Http- Request with the shorter name Request that's familiar to classic ASP programmers. Response.Write("UserAgent=" & Request.UserAgent & " ") Response.Write("UserHostAddress=" & Request.UserHostAddress & " ") Response.Write("UserHostName=" & Request.UserHostName & " ") Builds Responses Just as ASP.NET abstracts incoming data in the HttpRequest object, it provides a way to respond to the request via the HttpResponse object. Abstracting responses in this manner has been so successful that you'll find you need to know almost nothing about HTTP itself to use the HttpRequest and HttpResponse objects. Assists with State Maintenance Unlike a stand-alone or standard client-server application, Web applications are "stateless," which means that neither the client nor the server remembers each other after a complete request/response cycle for a single page finishes. Each page requested is a complete and isolated transaction, which works fine for browsing static HTML pages but is the single largest problem in constructing Web applications. Classic ASP introduced the idea of a session, which begins the first time a client requests any page in your application. At that point, the ASP engine creates a unique cookie, which the browser then accepts and returns to the server for each subsequent page request. ASP used the cookie value as a pointer into data saved for that particular client in an object called the Session object. Unfortunately, because the client data was stored in memory on a single server, this scheme did not scale well, nor was it faulttolerant. If the Web server went down, the users lost the in-memory data. ASP.NET uses much the same cookie scheme to identify specific clients, but the equivalent of the Session object is now called the HttpSessionState object. ASP.NET addresses the sessionscalability and data-vulnerability problems in classic ASP by separating state maintenance from the ASP.NET engine. ASP.NET has a second server application, called the session server, to manage session data. You can run the session server in or out of the IIS process on the same machine as your Web server or out of process on a separate computer. Running it on a separate computer lets you maintain a single session store across multiple Web servers. ASP.NET also adds the option to maintain state in SQL Server, which increases fault tolerance in case the session server fails.
|
|
|