Monday, January 24, 2011

Additional Consideration about Virtual directories

To create and test our ASP application we typically need to put all our .asp files inside webroot (C:/Intepub/webroot/My_Application/) and we have to type http://localhost/ My_Application in our web browser to test and run the application. But by creating virtual directory we can place our .asp files in any directory or system drive.

A virtual directory appears to browsers as if it were contained in a Web server's root directory, even though it can physically reside somewhere else. This approach enables you to publish Web content that is not located under the root folder of a Web server

To know more about virtual directory and to create a virtual directory please refer my article dated OCTOBER 7, 2010 Virtual Directory.

NOTE :  
  • You can create an almost unlimited number of virtual directories for your service, although performance may suffer if you create too many of them.
  • To locate virtual directories, the URL for the virtual directory must be specified. You can do this by either clicking a hypertext link that contains the URL or by typing the URL in the browser. For the gopher service, you can create explicit links in tag files so that users can access virtual directories.
  •  If you are using the NTFS file system, you can also create a virtual directory as follows:
    • 1. Right-click a directory in Windows Explorer.
    • 2. Click Sharing.
    • 3. Click to select the Web Sharing property sheet.
  •  In IIS 3.0, any virtual directory that is not associated with a specific IP address is accessible from all Web sites that are hosted on the server. In IIS 4.0 and later, this behavior is changed to make a virtual directory accessible from multiple Web sites that use multiple IP addresses. To make a virtual directory accessible from multiple Web sites that use multiple IP addresses, you must now add the virtual directory to each site.
  • Deleting a virtual directory does not delete the corresponding physical directory or files.

Thursday, January 20, 2011

Installing IIS and inetmgr

If you are running Windows XP Professional on your computer you can install Microsoft's web server,

Note: You can’t install IIS on Windows XP Home edition

Internet Information Server 5.1 (IIS) is free with the Windows XP Pro installation CD. You can install the IIS on your system by following the instructions below: -

1. On the Start menu, click Control Panel.
2. Double-click Add or Remove Programs.
3. Click Add/Remove Windows Components.
4. Click Internet Information Services (IIS) and then click Details.
5. In Internet Information Services (IIS), select the check boxes for SMTP Service and World Wide Web Service, and then click OK.
6. In Windows Component selection, ensure that the Internet Information Services (IIS) check box is selected, and then click OK to install the components that you selected.

When Installation is competed a new folder with the name INETPUB will be created in C drive of your system.

An other option to check whether IIS is installed properly or not

1. Click on the run
2. Type inetmgr

Wednesday, January 19, 2011

Internet Information Services

Internet Information Services (IIS) – formerly called Internet Information Server – is a web server application and set of feature extension modules created by Microsoft for use with Microsoft Windows.

We must have to install IIS in our local system to enable our ASP pages to run. In my Next Article i will explain how to install IIS

HTML Text Formatting

Open your text editor and type the following:

<title>Nebula Technologies Pvt Ltd</title>

  • Save the file as exo2.htm and preview it in the browser then return to your text editor
  • Everything you want to display on a web page is typed between the and the tags. 
  • For example, in the empty line between and , without pressing Enter, type: 
    • Located in the heart of Rockville, Maryland, the Grier Summer Camp is an attractive tourist setting aimed at entertaining and supporting youth activities during their summer vacation. Our youth programs and activities are as intense and stimulating as E=mc2 yet as lively as H2O.
  • Press Enter
  • You can make a character, a word or a group of words display following a certain style, for example italic, bold, or underline.

    To display a character, a word, or a group of words in italic, include it or them between the and the tags.
    To see an example, surround the word Rockville as follows: Rockville  
  • Save the file and preview it in the browser.
  • If you are using Internet Explorer, on its main menu, click View -> Refresh. Notice how Rockville displays now
  • Return to your text editor
  • To use the underline style, you   can include the desired character, word or group of words between the <u>   and the </u> tags.
  •  To see an example, change the Maryland word to   look as follows:

  • Save the file and preview it
  • To use the bold style, you include the desired character, words or group of words between the and the tags. The and the tags can also be used for the bold style. The and tags can be used to display text in big font. On the other hand, the and tags are used to display small characters.

    To see an example, on the long paragraph, change the following words to look as follows:
    <b>Grier Summer Camp</b>
  • Save the file and preview it.
  • Notice that the company name now displays in bold characters.
  • You can also combine styles to assign them to a character, a word, or a group of words. Simply type each desired tag at the intended beginning. There is no rule on the order of the tag, but although you can combine as many opening tags as you desire, you need to close them in reverse order. This means that, if you start with and follow with then type the word or group of words you want, in this case you would first close with followed by .

    To see an example, surround summer vacation as follows:
    summer vacation
  • Save the file. Preview it in the browser. Return to your text editor.
  • You can also strike through a text. To do that, use the <strike> and tags or the and tags.

    To see an example, make the following change:
    1st change: heart2nd change: is an
  • Some science or other documents   include characters that need to elevate or lower themselves in order to display   some formula. The <sub> and </sub> tags are used to display   characters as subscript text. On the other hand, the <sup> and   </sup> tags are used to display characters in superscript text.
  • E=mc<sup>2</sup> yet  as H<sub>2</sub>O.
  • Save the file. Preview it in the browser:
  • Return to your text editor that you can close at this time.

Monday, January 17, 2011

HTML Introduction

A graphical despiction of a very simple html d...Image via Wikipedia
 This article is for those who are very new in the web application. Through this article I am trying to give a brief introduction of HTML so that later on they can easily incorporate ASP in it.  

A file in HTML is first of all, a file saved with a recognizable extension (htm and html). Any one of these two extensions makes it a valid HTML file. If the file you are working on has already been saved, it should have a valid extension already. Otherwise, after creating a text file, to save it as HTML, makes sure you provide a valid extension.

HTML works by delivering two types of items to the browser: The items to display and the instructions on how to display those items. Everything in HTML is given to the browser as text. You can therefore display text “as is”. 

What is HTML?

HTML is a language for describing web pages.
  • HTML stands for Hyper Text Markup Language
  • HTML is not a programming language, it is a markup language
  • A markup language is a set of markup tags
  • HTML uses markup tags to describe web pages


HTML markup tags are usually called HTML tags
  • HTML tags are keywords surrounded by angle brackets like <html>
  • HTML tags normally come in pairs like <b> and </b>
  • The first tag in a pair is the start tag, the second tag is the end tag
  • Start and end tags are also called opening tags and closing tags
Practical Learning: Creating an HTML file
  1. We will first need a folder to work with.
    • If you are using Microsoft Windows 9X, Me, or XP Home Edition, create a folder on the C:\ drive and call it tutorial
    • If you are using another operating system, create a folder or directory called tutorial where you can easily locate it.
  2. Start your text editor.
    • If you are using Microsoft Windows, to start Notepad, click Start -> Programs -> Accessories -> Notepad.
To have text to display, in the empty window, type the something like “ hello world” or any thing you want. 
  • To save the file, on the main menu, click File -> Save 
  • Locate the tutorial folder or directory you created. Display it in the Save In combo box.
  • Change the Save As Type or File Type combo box to All Files.
  • Set the name of the file to first.htm
  • Click Save.

Previewing an HTML File

There are different ways you can preview an HTML file. First you will need a browser. The two most popular browsers used on Microsoft Windows and Apple operating systems are Netscape and Microsoft Internet Explorer.
To preview an HTML file, you can display it in My Computer, Windows Explorer, or the Home Directory windows. After displaying the folder or the directory that contains the file, double-click the file. If the browser is already opened, on the main menu, click File -> Open. Locate the folder or directory where the file was saved and select the HTML file you want to preview.

Practical Learning: Previewing an HTML file
  • Open My Computer, Windows Explorer, or your Home Directory window.
  • Locate the folder or directory where you saved the first.htm file to display it.
  • Double-click the file: A browser should open with the file. After viewing the file, close the browser.
Enhanced by Zemanta

Monday, January 10, 2011

How Can MTS Help us?

Beyond all the features and advantages already mentioned, possibly the biggest advantage that MTS provides is the capability to update a component without stopping the server. When IIS uses a DLL, it "locks" the DLL into memory. To replace the DLL, you must stop IIS. During development that's no problem at all, but in a production environment it may be impossible to stop the server simply to update one component for your application. Other users may be in the middle of critical operations in other applications running on that server. If you stop the server, you destroy all the sessions.

Using the Internet Service Manager, you can mark your applications so that they run in a separate process space than the root Web application. If you do that, you can release DLL locks on components used exclusively by your application by unloading the application. That helps, but not enough. If any other application is using the DLL, unloading your application won't release all the locks, and you'll still be unable to replace the component. If you run the component under MTS, you can release all references and replace the component without having to stop the applications. Of course, depending on the application's needs, you may still affect the application if you update components while the applications are running.

The second largest advantage is that MTS maintains objects in memory. Throughout this book, I've tried to hammer home the first rule of Web programming: Get in, get the data, get out. Almost anything that can help you do that is worth doing, and you'll see immediate benefits, either in application responsiveness or in application scalability. Unfortunately, few things that you can do will improve both responsiveness and scalability. MTS does slow down application initialization, so the first people to reach your application will have to wait longer for the application to load. After it's loaded, though, you'll be able to scale much better with MTS than without it.

Finally, MTS lets you group functionality and control access to functionality through role-based security. In many Web applications, where users access the site anonymously, this kind of security won't do you any good. On intranet sites, where all the people accessing the application can be authenticated through the network, MTS security is a blessing. Instead of having to set individual properties or write code, you can break your application into interfaces and assign permissions to the interfaces.

When Should we Use MTS?

At first, I thought that MTS should be limited to large sites. After creating several IIS applications (with both ASP and VB WebClasses), I've come to realize that you should always use MTS. MTS is much like SQL Server. You think it's overkill—more power than you need—until you deliver your application. When 20 people hit your site at the same time and the server reaches 100 percent usage, you begin to realize that you should have done things differently. I now believe that you should plan for and use MTS in almost all Web applications, whether you think you'll need it or not.

Writing and coding an MTS component is more work than writing a standard ActiveX DLL. Because MTS wants (and for efficiency, requires) stateless components, you need to maintain state elsewhere. It seems as though in the last few years we've moved from an individual client, where you maintained state because that's where your program was running, to a two-tier, then a three-tier, and finally a three-tier-with-MTS application. Each time programming practice adds a layer, you have to write more code. Also, it seems like each added layer wants to shirk the responsibility for maintaining state. For example, you don't want to maintain state on the client—the space available is limited, it's inherently insecure, and it causes too much network traffic. You don't want to maintain state on the Web server—it uses up server resources and slows response time. You don't want to maintain state in the data services components—they need to be stateless so that multiple clients can use them. That puts the burden of state maintenance squarely on the business components. But wait—isn't it more efficient to put the business components in MTS and make them stateless, too? That's right! The answer is, it's just not efficient to maintain state.

State maintenance in Web applications, as you've seen, requires a change in your approach to application programming. Planning an application that uses MTS requires a similar change in mindset. The point is, you need to start approaching all Web applications as though you were unable to maintain state at all. Only grudgingly, when it's absolutely necessary, should you maintain any state information for a client. And when you do, you'll have to decide which will hurt your application's performance the least—to store it on the client, the Web server, or the business component layer. Welcome to the modern world of Web applications, where performance and reusability, but not responsibility, are the watchwords of the hour.

So now that you understand the benefits of using MTS and you know when to use it in your applications, the next section will show you how can you use MTS components with WebClasses

What Is MTS?

MTS consists of several unrelated capabilities lumped together under a single name. Microsoft, recognizing that MTS is not an accurate name for this collection of features, has renamed MTS to COM+ in Windows 2000.

MTS is an object broker. That means it maintains a list of objects and facilitates other programs' use of those objects. MTS facilitates code reuse. Without MTS, you would have a difficult time sharing objects within your program and between programs. You would have to set up a pool of objects, then devise ways of sharing them without conflict.

MTS is also a transaction monitor. MTS can monitor and manage transactions—work that must either complete successfully or fail totally across multiple components. For example, suppose you want to send e-mail to an administrator each time an employee changes personal income tax deductions. The transaction consists of all the operations required for the employee to make the change in a database and also all the operations required for the program to compose and send the e-mail message to an administrator. If any error occurs when making the database changes, you don't want the program to send the e-mail. If the database changes succeed, you must send the e-mail message successfully; otherwise, you need to roll back the changes in the database and inform the employee that the program cannot make the changes.

If you set this up, you would need to write code to ensure that each part of the process completed successfully before committing the transaction. You would also need to write code to roll back the transaction if any error occurred. MTS handles all these issues for you.

MTS uses components to perform the units of work involved in a transaction. A component and a class are, to the VB programmer, essentially identical. VB programmers discuss classes and objects. MTS programmers discuss components. A component has a specific COM interface, and so does a VB class. A DLL may contain several components or classes, just like in VB. You can't create classes with multiple interfaces in VB (although you can make classes that use multiple interfaces).

Using Cookies with ASP

The ASP engine maintains Session state with cookies; if the user's browser won't accept cookies, the ASP engine cannot maintain Session state for that user. That's because there has to be some sure method of identifying a particular browser. Given the uniqueness of IP addresses, you'd think that they would be perfect for identifying a particular browser, but no such luck. Multiple users often share an IP address or block of addresses. That's what a proxy server does—it maps the user's "real" IP address to one or more public IP addresses. The proxy then makes the request via the shared address. Therefore, it's perfectly possible for two or more browsers to access your application from the same IP address. Enter the cookie.

Cookies are text strings that a browser sends to a Web site each time it requests a page from that site. You can use HTTP headers to manipulate the contents of cookies directly, although it's much easier to use the Response.Cookies collection methods. Of course, that's all that the Response.Cookies collection does—send HTTP headers to add, alter, or delete cookies.Basically, there are two kinds of cookies:

  • In-memory cookies These are held in memory, which means they disappear when you close the browser.
  • Persistent cookies These are persisted to disk, which means they expire when you delete the file or when their expiration date arrives, whichever comes first.
The ASP SessionID cookie is an in-memory cookie.
Because some people don't want to accept any information that might identify them to a Web site, browsers generally have a setting that lets you refuse cookies. ASP sites typically don't work well if the browser doesn't accept cookies, because most ASP sites rely on the cookie so they can maintain session information for us.

The ASP engine writes a SessionID cookie as soon as the user requests the first file from an ASP application. The ASP SessionID cookie is in every way a normal cookie, except that it is usually invisible to your application. If you query the Request object cookie collection, you won't see the ASP SessionID cookie. You can prove it by creating the following ASP page script:


<html><head><title>List Cookies</title></head>



Dim V

If Request.Cookies.Count > 0 then

For each V in Request.Cookies

Response.Write V & "=" &

Request.Cookies(V) & "<BR>"



Response.Write "No Cookies"

End If




Name the file and place it in a Web site. If you're using Visual InterDev, create a new Web project and call it ASPProject1, add a new ASP file, and place the code listing in it. Now use your browser to navigate to the page. You will see the text No Cookies. What happened?
Now, add one more line of code to the file, just before the end-of-script marker—the percent sign and right bracket (%>):

Response.Write "HTTP_COOKIE=" &

Request.ServerVariables("HTTP_COOKIE") & "<BR>"

This line of code displays the "raw" contents of the HTTP_COOKIE variable, without the filtering and organization applied by the ASP engine for the Request.Cookies collection. Run the file again (by refreshing the page). This time, you'll see No Cookies, and another line as well, that probably looks something like this:


That's the ASPSESSIONID cookie. It's a meaningless, semi-random ID that is highly likely to be unique. The ASP engine doesn't show it to you because you didn't generate it—the ASP engine did. I guess Microsoft thought it would be confusing to request the cookie count and get a 1 in response before ever setting a cookie yourself.

Consider one more interesting fact before we move on to a larger ASP project. Add this line to the end of the code listing:

Response.Write Session.SessionID

Refresh the page again. This time, you should see one additional line containing a long integer number like 411057027. The SessionID property doesn't return the SessionID cookie value at all! So will the "real" Session identifier please stand up? It turns out that the real SessionID is the long integer. The ASP engine generates the cookie as a long string of text for security reasons. It's much harder for a hacker to guess the long cookie string value than to guess the long integer value with which the cookie string is associated on the server.