Showing posts with label browser. Show all posts
Showing posts with label browser. Show all posts

Friday, 10 August 2007

ASP.NET AJAX ScriptManager in Web Applications

Today the buzz word is "AJAX". It's a great technique used to create interactive web applications. It makes the web applications responsiveness similar to client-side standalone applications. ASP.NET AJAX was released by Microsoft to easily integrate into web applications. The central component, ScriptManager control is the core of ASP.NET AJAX. Its primary role is the arbitration of all other ASP.NET AJAX controls on the Web Form and the addition of the right scripting libraries to the Web browser so that the client portion of ASP.NET AJAX can function.

Scripting with ScriptManager

ScriptManager reacts to events in the ASP.NET page lifecycle and uses those events to coordinate the activities of all the controls, options, and code employed by ASP.NET AJAX. ScriptManager will hook a particular event, get notified when it occurs, and configure a few settings depending on the environment; this process will repeat itself several times through the rendering cycle of your ASP.NET page.

The steps necessary to create a class based on the ASP.NET AJAX script extensions are:

  • Register the namespace with ASP.NET AJAX
  • Create a constructor method
  • Create a class prototype by filling in the member methods and their functionality
  • Register the class with ASP.NET AJAX
  • Notify the client script added by the ScriptManager that you have reached the end of the type definition (the call to Sys.Application.notifyScriptLoaded).

WorkFlow of ScriptManager

 

The workflow of the scriptmanager is shown in the figure. It gives an idea of how the scriptmanager registers and responds to events. You can find out more information about ScriptManager.

Thursday, 14 June 2007

Testing AJAX applications with Fiddler

Testing AJAX web applications is very difficult. Ajax relies mainly on requests to the server  ( and responses received from them). We can't test what is sent and received from the server. The way to solve these problems is to use HTTP Proxy.

A HTTP proxy is a small program which intercepts between the client requests and responses to and from the server. The browser sends a request and the HTTP proxy receives the request. It then sends the request to the server and when it is processed, the response is sent back to the HTTP proxy. It is then sent to the browser. In addition to the interception job, it also records the information transfer. Fiddler is one such HTTP proxy tool which is used for testing and debugging Ajax applications.

                              

Fiddler, a free tool is an HTTP proxy for WINInet, which is the Internet Communication library used by many desktop applications, including Internet Explorer. Once installed, Fiddler automatically begins intercepting HTTP traffic to and from your computer.

Download Fiddler

Configuring Fiddler

If you want to get fiddler to listen to the requests too, go to Tools > Options > Connection > Connection Settings and check "Manual Proxy Configuration", "Use the same proxy for all protocols" and enter 127.0.0.1 port 8888 and click OK.  Note that this will pose problems if you close Fiddler as your proxy is gone, to solve the problem change back to "direct connection to internet".

Using Fiddler

The Fiddler window has two main regions. The left region shows all the requests that were sent from the machine. Each request is represented in a line. The line includes the response status, the protocol used (usually HTTP), the host name, the URL, the caching type, the length of the response, and the content type.

The right region has three tabs which are Performance Statistics, which displays information relating to data transmission rates, including the number of bytes sent and received as well as the types of data received. The Session Inspector tab provides information about the request and the accompanying response. The Request Builder tab allows you to manually construct a request and observe its response.

Another main feature of Fiddler is it has the ability to set breakpoints for HTTP requests and responses. As the request breakpoint is set, the Session Inspector tab is filled with information about the request. We can change the request before it is sent to server. Similarly, before the response is sent back to browser, we can edit the response.

Ajax debugging with Fiddler

  • Ensures that correct data is being sent to the server
  • Ensures that the data is sent in correct format and contains correct data
  • Checks whether correct response is received from server
  • Setting breakpoints for the request and response helps in finding out the error easily

Once you've recorded a session in fiddler you can then select the requests you're interested in, right click them and save them as a Visual Studio Web Test. You now have an XML file with the .webtest extension, ready to be imported into Visual Studio. Web Tests are used for testing the applications in Visual Studio 2005. You can know more information from my previous post Web Tests with Visual Studio 2005

You can find the Fiddler demonstration videos at this link

Source Via [Wrox Article]

Tuesday, 12 June 2007

Review of Apple Safari 3 Beta

 Apple Corporation has released a beta version of their web browser Safari 3 Beta for windows machines. It's look and feel is similar to the Apple's trademark. If you use Mac OSX and iTunes, you would feel the similar. Apple corporation included Safari web browser in Mac OS X. Previously, Apple hasn't released any of their safari versions for Microsoft machines.

The Beta release offers three choices for download.

  • Safari plus Quicktime for Windows XP and Vista
  • Safari for Windows XP and Vista
  • Safari for Mac OS X systems
Download Safari for Windows XP and Vista

The setup process has a choice to install Bonjour protocol onto your system. This is unfamiliar to the Microsoft windows users. Apple's Bonjour protocol finds the local IP address of all devices such as your network printer.

Reviews and findings on Safari 3 Beta

Pros:

  • When compared to other browsers, the application launch time is very less. The moment you double-click the application, it instantly loads.
  • It loads the pages faster than IE and Opera. It is said that Safari loads 2 times faster than IE 7 and 1.6 times than Firefox 2.
  • It executes javascript faster than IE 7 and Firefox 2
  • The UI is similar to Mac style. The animation of the bookmark window is a sample of Apple's trademark style.
  • Has the features of blocking popups, autofilling forms, Tabbed browsing, bookmarking, Built in RSS and security
  • Rendering the page is excellent and more clear. You will find the difference when you open the same page in different browsers.

Cons:

  • Offers very few plug-ins
  • It takes time to load the previous page when clicked on back button. It's not using cache but instead requesting the page.
  • Doesn't preview tabs.
  • Often crashes like when the Autofill function is activated, crashes when one tries to fill the text field
  • Problems with loading bookmarks
  • Shows error messages such as: "Safari is missing important resources and should be reinstalled."
  • Some problems with the fonts not being loaded on the web pages
  • Problems with installed iTunes software when installed

On a whole, Safari 3 beta is a mixed-bag. There are some good features and many features yet to implement. The current Firefox and IE users will feel disappointed due to the lack of add-ons and plugins. Lets hope Safari 3.0 would resolve all these issues.

Download Safari for Windows XP and Vista