Thursday, August 28, 2008 page execution

The ASP .Net is proved to be a worth while time spent by programmers to create applications, by providing a very rich Framework Class Library (FCL), Performance tuning, Security, Manageability etc., It has been said and written that ASP .Net follows a compiled execution model.
Sometimes we used to get some doubts about whether writing the code inside the code behind file is faster, some times we are not aware of how the compilation of the code happens etc., This article tries to take a brief look at some of the internals about the ASP .Net Compiled Page Rendering and Execution model along with some other related concepts, clearing such doubts.

Compilation of ASP .Net Pages:

It is a well known fact that ASP .Net pages functional logic can be written in two ways. The ASP .Net code can either be written inside the ASPX page or it can be included as a asp_net_code.cs or vb .net file.
When the ASPX page is embedded with the code of either C# or VB .Net, the ASP .Net run time automatically compiles the code into an assembly and loads it. If the code is kept in a separate source file either as a VB or C# file, it has to be compiled by the programmer, which will be used by the run time for further execution.

Compilation of Script Inside the aspx pages:

When a page is created with the tags inside the .aspx page itself, the code can be written at two locations. It can either be placed inside the tag or any where inside the page within the <%.. %> server code blocks. When the code is placed inside the script tag, it is treated to be class level code and any other code found is considered to be a part of the method that renders the web page.
When a the aspnet_wp.exe gets a request for an aspx page which is written without a code behind class file, it generates a class file dynamically for the corresponding page and places it inside the Temporary ASP .Net Files somewhere under the tree structure of the .Net installation path. Then it compiles this into a DLL and finally deletes the class file after successful compilation. It will render the pages from the same binary DLL for any subsequent requests. If it sees any change in the time stamp of the .aspx file, it recognizes that there is some change and recompiles it again for further use.
So ultimately the compilation is only once and all the subsequent requests are entertained only by using the compiled code/DLL.

Writing ASP .Net Apps with Code behind files:

The compilation of these Code Behind files is usually done manually either using the csc.exe command line compiler or by using the Build feature in Microsoft Visual Studio .Net, which produces an output as a library with an extension of .DLL. Now the job of aspnet_wp.exe is very simple. It can directly execute the compiled code and return the HTML page to the web server.

Execution Flow of ASPX Pages by IIS:

The execution of ASP .Net pages are not singly handled by the Internet Information Server or in short hand form IIS. It is taken care by the worker process aspnet_wp.exe. Whenever the IIS receives a request from a web browser or a client requesting for a page, it delegates the job to the aspnet_wp.exe process, which takes care of the subsequent jobs and finally returns the HTML page back to the IIS.
When ASP .Net is installed, installation process creates an association for .aspx files with the aspnet_isapi.dll files. When the IIS receives a request from the clients or web browsers for an aspx page, the IIS web server hands this request over to the aspnet_isapi.dll, which in turn instantiates the aspnet_wp.exe job. This aspnet_wp.exe finalizes any unfinished jobs like run time compilation etc., as explained above and then executes the asp .net application in a new application domain. Finally the output page is generated and returned back to the web server, which in-turn sends the file over to the client.
The above is a very robust model of executing an application extending support to both the code behind and code embedded inside aspx pages. Ultimately writing the code in any place be it inside the code behind files or inside the aspx page will always be faster and will not have any performance difference between the two approaches.
But writing the code inside a separate class file makes a clean coding approach with a separation of UI from the logic.

Browser Script vs Server Script

Diff . between Browser - ( BS ) and Server Script ( SS )

Browser Script :

1. Only eScript can be used in BS whereas in SS., both VB / eScript can be used.
2. BS can be used for data validation in the current context ., i.e Execute query cannot be done.
3. Interaction with desktop applications
4. To get inputs from the user.
5. The only fields that are available to browser script are:
• Id Field
• Fields whose values appear in the UI

Server Script:

1. Query, insert, update, and delete operations
2. Access and data validation beyond the current record

Practical hints:
1. While debugging you cannot step thru Browser script by placing break points
2. Browser script is generated in public\enu folder
3. You may have to run genbscript to generate browser script ., if you have not set the browser script folder in tools.
4. The server script executes in the server object manager in thin client and in the client machine of mobile client / dedicated client.
5. Browser script executes in the client browser javascript interpretter

For Methods information please refer siebel object interface reference.

To keep it simple, JavaScript forms Browser Script & VB/eScript forms Server Script... Browser script is interpreted by Browser while Server Script is interpreted by Object Manager....

Is it true that Server script really executed in Server?

As when we do the coding and test in mobile client, it seems we don't need the server and can still execute server scripts.
Yes its TRUE....the .exe interprets Server Script....

Web Servers

A Web server is a program that, using the client/server model and the World Wide Web's Hypertext Transfer Protocol (HTTP), serves the files that form Web pages to Web users (whose computers contain HTTP clients that forward their requests). Every computer on the Internet that contains a Web site must have a Web server program. Two leading Web servers are Apache, the most widely-installed Web server, and Microsoft's Internet Information Server (IIS). Other Web servers include Novell's Web Server for users of its NetWare operating system and IBM's family of Lotus Domino servers, primarily for IBM's OS/390 and AS/400 customers.
Web servers often come as part of a larger package of Internet- and intranet-related programs for serving e-mail, downloading requests for File Transfer Protocol (FTP) files, and building and publishing Web pages. Considerations in choosing a Web server include how well it works with the operating system and other servers, its ability to handle server-side programming, security characteristics, and publishing, search engine, and site building tools that may come with it.


Often referred to as simply Apache, a public-domain open source Web server developed by a loosely-knit group of programmers. The first version of Apache, based on the NCSA httpd Web server, was developed in 1995.
Core development of the Apache Web server is performed by a group of about 20 volunteer programmers, called the Apache Group. However, because the source code is freely available, anyone can adapt the server for specific needs, and there is a large public library of Apache add-ons. In many respects, development of Apache is similar to development of the Linux operating system.
The original version of Apache was written for UNIX, but there are now versions that run under OS/2, Windows and other platforms.
The name is a tribute to the Native American Apache Indian tribe, a tribe well known for its endurance and skill in warfare. A common misunderstanding is that it was called Apache because it was developed from existing NCSA code plus various patches, hence the name a patchy server, or Apache server.


Microsoft Internet Information Services (IIS, formerly called Internet Information Server) is a set of Internet-based services for servers using Microsoft Windows. It is the world's second most popular web server in terms of overall websites, behind Apache HTTP Server. As of June 2008 it served 35.39% of all websites according to Netcraft. The servers currently include FTP, SMTP, NNTP, and HTTP/HTTPS.
• IIS 1.0, Windows NT 3.51 available as a free add-on
• IIS 2.0, Windows NT 4.0
• IIS 3.0, Windows NT 4.0 Service Pack 3
• IIS 4.0, Windows NT 4.0 Option Pack
• IIS 5.0, Windows 2000
• IIS 5.1, Windows XP Professional,Windows MCE
• IIS 6.0, Windows Server 2003 and Windows XP Professional x64 Edition
• IIS 7.0, Windows Server 2008 and Windows Vista


The first Microsoft-endorsed webserver was a research project by the European Microsoft Windows NT Academic Centre (EMWAC), part of the University of Edinburgh in Scotland, and was distributed as freeware. However since the EMWAC server was unable to scale sufficiently to handle the volume of traffic going to, Microsoft was forced to develop its own webserver, IIS.
IIS was initially released as an additional set of Internet based services for Windows NT 3.51. IIS 2.0 followed adding support for the Windows NT 4.0 operating system and IIS 3.0 introduced the Active Server Pages dynamic scripting environment.
IIS 4.0 dropped support for the Gopher protocol and was bundled with Windows NT as a separate "Option Pack" CD-ROM.
The current shipping version of IIS is 7.0 for Windows Vista and Windows Server 2008, 6.0 for Windows Server 2003 and Windows XP Professional x64 Edition, and IIS 5.1 for Windows XP Professional. Windows XP has a restricted version of IIS 5.1 that supports only 10 simultaneous connections and a single web site. IIS 6.0 added support for IPv6. A FastCGI module is also available for IIS5.1, IIS6 and IIS7.
Windows Vista does not install IIS 7.0 by default, but it can be selected among the list of optionally installed components. IIS 7.0 is available in all editions of Windows Vista except Home Basic and Starter. IIS 7 on Vista does not limit the number of allowed connections, like IIS on XP did, but limits concurrent requests to 10 (Windows Vista Ultimate, Business, and Enterprise Editions) or 3 (Vista Home Premium). Additional requests are queued which hampers performance but they are not rejected like in XP which resulted in the 'server too busy' error message.

Wednesday, August 27, 2008


A website (alternatively, web site or Web site, a back-construction from the proper noun World Wide Web) is a collection of Web pages, images, videos or other digital assets that is hosted on one or more web servers, usually accessible via the Internet.

A Web page is a document, typically written in (X) HTML that is almost always accessible via HTTP, a protocol that transfers information from the Web server to display in the user's Web browser.

All publicly accessible websites are seen collectively as constituting the "World Wide Web".

The pages of websites can usually be accessed from a common root URL called the homepage, and usually reside on the same physical server. The URLs of the pages organize them into a hierarchy, although the hyperlinks between them control how the reader perceives the overall structure and how the traffic flows between the different parts of the sites.

Some websites require a subscription to access some or all of their content. Examples of subscription sites include many business sites, parts of many news sites, academic journal sites, gaming sites, message boards, Web-based e-mail, services, social networking websites, and sites providing real-time stock market data. Because they require authentication to view the content they are technically an Intranet site Intranet.

Roughly speaking, there are two kinds of Web sites: those with static content and those with dynamically generated content. These are also called static Web sites and dynamic Web sites, or Web sites with static pages versus Web sites with dynamic pages.

What is Web content? Content is everything that can appear on a Web page: text, graphics, form fields, hyperlinks to other pages, navigation buttons, menus, etc.

Static Web Sites

For a static-content Web site, all content appearing on Web pages is placed manually by professional Web developers. This is also called "design-time page construction," because the pages are fully built while the site is being developed. Static-content Web site is developed and then maintained by experienced professionals. Such Web site usually costs less when initially developed, but then all future changes still have to be done by Web professionals. Therefore a static Web site can be more expensive to maintain, especially when you want to make frequent changes to your site.

In the case of static Web sites, all the pages are fully constructed by Web designers; any subsequent changes also need to be made by them.

Such pages are called "static" because their content doesn't change dynamically - the only way to change them is to have a Web designer modify them explicitly.


To better understand Web sites with static content, let's consider the following example.

John owns a small bakery. One day he decides to advertise his business on the Internet. On his Web site, he wants to put information about breads, rolls, bagels, doughnuts, and cakes his bakery makes. Few times a year he comes with a new kind of bread or cake, so he would like his Web site to be updated when this happens. In addition, he wants to have a map with directions to help new customers with locating his bakery. He also decides that he is not going to sell his baking goods online.

Correctly, John selects static-content Web site: he is not going to have many changes to his Web site. This also helps him keep the initial Web site development costs down.

Few months later...

John's new Web site proved to be quite a success: he got new customers. But now they have to wait longer because the line is longer... So he starts to think about hiring a new person to speed up the ordering line. However, many customers, especially these who found him online, keep asking about ordering his baking goods online. In most cases, they told him that they would like to order the day before and then the next next morning just stop by to quickly pickup the order. John likes the idea, because this would reduce the line and help him in better planning while reducing the waste. However, he is aware that adding credit card transactions online might be too costly. But if he could just receive emails with orders...

To John's surprise, the changes required to support online ordering where not very costly: a simple shopping cart had to be added to his site, but other than that the content on his site remained static.


Based on the above discussion, we can summarize when a static-content Web site is a good idea:

Pages on the site are not going to change frequently. This applies to cases when:

you don't have to frequently change text and graphics on your main pages;

the products and/or services your company offers don't change much over time..

The list of products and/or services is not very long and individual pages describing them can be easily constructed.

There is no need for a sophisticated online ordering system. This means that you either don't plan to have online orders, or you will be fine with a very simple, email-based ordering system. Such ordering system supports basic shopping cart functions like selecting multiple items and calculating the total amount owned. Once the order is confirmed, it is delivered to you by email.
However, this simple ordering system cannot support advanced features like order tracking, long list of available products, verifying availability of requested items against what you have in stock, automatic stock tracking, online credit card transactions, and the like. If you require any of the above advanced options, you will need a dynamic Web site.

You don't need to have your Web site in any way connected to your back-end system.

The Web site itself is not offering any services to the visitors.

Dynamic Web Sites

On the other hand, pages in a dynamic-content Web site are constructed "on the fly" when a page is requested from a Web browser. Dynamic-content Web site, while still developed by professionals, can be maintained directly by you, our customer. Such Web site initially costs more to develop, but then you don't have to pay Web professionals every time you need to change something on your site. If you plan to make frequent changes to your site, you most likely will be better off with a dynamic Web site.

In the case of dynamic Web sites (a.k.a. database-driven Web sites, or Web applications), page content is generated based on some information usually stored in a database or resulting from processing the inputs provided by the Web site visitor. This information , and thus the corresponding pages, can be changed by you and/or the visitor at any time.

The pages are called "dynamic" because their content is generated "on the fly" each time a page is requested by the Web site visitor. Of course, typically dynamic Web sites also have some static pages, too.

Next, we will walk you through several examples to get you familiar with what can be achieved with dynamic Web sites.

First Example

Diana and Tom are music teachers. They both give piano and violin lessons to children. They have a number of dedicated students who come for lessons every week. But they also offer ad-hoc tutoring, especially for children playing in school orchestras that need more help before a scheduled concert for parents. Scheduling such ad-hoc lessons is time consuming: it usually requires several phone calls between them and parents to confirm availability.

Tom and Diana want to have a Web site describing and advertising their piano and violin lessons. In addition, they want potential students or their parents to be able to see available time slots and schedule lessons using an online calendar. Both Tom and Diana would each enter their already scheduled classes into the calendar and would also like to block some time as not available. Additionally, they want to be able to see who is scheduled for any day and time, but they don't want anybody else see such details: the "publicly visible" calendar should just display time availability.

Implementing such online calendar with scheduling capabilities requires pages with dynamically generated content. Additionally, part of the Web site will have to be protected with a special password so the access to it would be limited only to Diana and Tom.

Second Example

An online store is a common example these days. Many existing stores want to have Internet presence. Roughly speaking, there are three approach to online presence for stores:

Online store info - Web site contains only basic information about the store and offered products. Shoppers have to either visit the store in person or order a paper catalog.
Static Web site will be just fine for this approach.

Online catalog - clients can browse the catalog, see details of each catalog item, but they can't place online orders.
Although online catalog could be built as a static Web site, this is not a practical approach because frequent changes required to keep the catalog up to date will quickly surpass the cost of building dynamic Web site.

Online shopping - clients can browse and order products online. This means that the Web site not only provides the catalog of products, but also implements an "online shopping cart" that simplifies online purchasing.
Such Web sites are typically built as dynamic, database-driven sites.


To summarize, if any of the below conditions apply, you will most likely need a dynamic Web site:

You have to change your main pages frequently because you want to have people coming back to your site.

Products and/or services your company offers change frequently. This especially applies to stores.

You want to be able to quickly change product prices, mark some products as being on sale, offer special promotions, mark recently added items as new and automatically show new products on special pages, etc.

You will be frequently adding new products/services and removing some of the existing ones.

The list of your products or services is too long - time (and therefore cost) spent for developing the corresponding static pages would be larger than developing Web site based on a database of products and dynamically generated pages describing products.

You need to have a more complex ordering system capable of supporting one or more of the following functions:

checking availability of items against the stock,

maintaining the stock,

tracking orders with order status (like received, shipped, on back-order, etc.),

paying online with automated credit card transactions,

You Web site is to have advanced search capabilities, for example, by product brand name, by price range, by product specifications or parameters, by service type and time availability, etc.

You want to track your customers and possibly offer personalized services for them. For example, if a person bought a camera, you may want to show her or him matching equipment that is currently on sale. Or you want your clinic's Web site to pickup the assigned doctor when scheduling a new appointment.

Your Web site should do the mapping of customer needs to available services. This includes many different opportunities like online doctor appointment system, finding available time for music lessons, pre-selecting services based on several questions asked, at many more.

The Web site accepts some inputs from a visitor, processes it and generated the resulting page. In some cases, such processing could also modify some information in the database permanently affecting content some other pages show. For example, this includes a Web site that enables the visitor to find and book an available time slot for a music lesson; once booked, this time slot would not be shown as available to other visitors.

You need to connect your Web site to the existing back-end system.