What is the difference between a web application and a traditional windows application? A great example of a windows application is Microsoft Office, which is installed on a client’s workstation; other than calls to the database server to save and retrieve data, all the source code and assemblies are run locally. In fact, it is a requirement that a windows application be installed on the client’s workstation. Web applications, on the other hand, don’t need to be installed on individual workstations. An internet connection and a browser like Internet Explorer, Firefox or Google Chrome is all you need. However, the majority of the processing will not take place on the client’s browser, but on a web server at some other location.
The Need for Client-Side Scripting
As web applications become more and more powerful and sophisticated, it is expected that they function and act just like a windows application. The basic architecture for a web application is that most of the source code and assemblies reside and are processed on a web server. The sole task of a web server is to accept incoming HTTP requests and to return the requested resource in an HTTP response. There is never a continuous live connection between the client’s browser and the web server. Web pages will always be in the form of HTML.
PostBack is the name given to the process of submitting an ASP.NET page to the server for processing. Every time a PostBack happens, the HTML page is sent to the web server. The server loads the page, processes events and renders the new HTML back to the client. On a PostBack, the entire HTML is refreshed.
For large and complex web-applications that store a large amount of View state, this can be very time consuming for the client. This will become a huge problem for a web server with limited resources like memory and bandwidth.
Web applications will usually embed view state in the HTML page. Quoting Microsoft, “Microsoft® ASP.NET view state, in a nutshell, is the technique used by an ASP.NET Web page to persist changes to the state of a Web Form across postbacks.” View state allows the state of objects to be stored in a hidden field on the page. View state is transported to the client and back to the server, and is not stored on the server or any other external source. View state is used to retain the state of server-side objects between postbacks and will become very large for large applications and pages.
The two main benefits of client-side scripting are:
- The user’s actions will result in an immediate response because they don’t require a trip to the server.
- Fewer resources are used and needed on the web-server.
Ajax and jQuery
The two huge advances in client-side scripting are Ajax and jQuery. Ajax is not a tool or a programing language, but a concept. The concept is to call the server directly from the client without doing a PostBack. The main advantage of Ajax is to save and retrieve data from a database, bypassing the web server, which is known as a CallBack. Web Services will be created to do database operations. Your client-side scripts will call these web-services asynchronously.
As web applications become larger and more complex, combined with the increasing popularity of mobile applications that run on smart phones and other mobile devices, the need for client-side scripting, Ajax and jQuery will continue to grow.