Signup · Login
Stardeveloper.com  
Home · Tutorials · Forums · Web Hosting Plans · Faisal Khan's Blog · Contact
Search Stardeveloper.com
Stardeveloper RSS Feed
Newsletter
Enter your email address below to be informed every time a new article is posted at Stardeveloper.com:

You can follow Faisal Khan on Twitter
Article Categories
.NET  .NET
  ASP (16)
  ASP.NET (41)
  ADO (16)
  ADO.NET (10)
  COM (6)
  Web Services (4)
  C# (1)
  VB.NET (3)
  IIS (2)

J2EE  J2EE
  JSP (15)
  Servlets (9)
  Web Services (1)
  EJB (4)
  JDBC (4)
  E-Commerce (1)
  J2ME (1)
  Products (1)
  Applets (1)
  Patterns (1)
Log In
UserName Or Email:

Password:

Auto-Login:

Miscellaneous Links
  Submit Article

Hosted by Securewebs.com
 
Home : .NET : COM : ASP Intrinsic Objects from within COM Component
 
  • Step 12 : Now go to File -> Make Stardeveloper.dll . A small dialogue window will open asking the name of DLL, by default Project name which in this case is Stardeveloper.dll is used. But you should edit it so that it becomes 'CheckBrowser.dll'. And then hit 'ok'.
  • If every thing goes fine then our component with ProgID 'Stardeveloper.CheckBrowser' will be created in the 'CheckBrowser.dll'. On the next page we will create a simple ASP page and make use of our created component.

    Create a new ASP page and name it 'checkbrowser.asp'. Copy and paste the following code into it and then save it :

      <html>
      <head>
       <title>
       Stardeveloper.CheckBrowser Component.
       </title>
       <style>
         body { font-family : Verdana; font-size : 10pt; }
       </style>
      </head>
      <body>
     <%
      ' Declaring variables
      Dim objcb
      Set objcb = Server.CreateObject("Stardeveloper.CheckBrowser")
      ' Using our component's methods to send browser speicific code to the client
      If objcb.IsIE Then
      ' Browser is Microsoft Internet Explorer
      Response.Write "Microsoft Internet Explorer specific code goes here..."
      ElseIf objcb.IsNS Then
      ' Browser is Netscape Navigator
      Response.Write "Netscape Navigator specific code goes here..."
      Else
      ' Browser is neither Internet Explorer nor Navigator
      Response.Write "Code for other browsers goes here..."
      End If
      ' Done. Now destroy the objcb object
      Set objcb = Nothing
     %>
      </body>
      </html>

    Now save the page in a directory from which you can run ASP pages. To run the ASP page e.g. if you have saved the page in directory c:/inetpub/wwwroot/checkbrowser.asp then type http://127.0.0.1/checkbrowser.asp in the URL box of your browser and hit 'enter'. Depending on the type of your browser you will see a browser specific code message displayed on the browser. Try it out yourself and see it working.

    Conclusion
    We learned in this tutorial how to create a component and how to use ASP Intrinsic objects from within the component. We made use of Request object in our methods to determine client browser. This tutorial will have given you enough knowledge to start creating components which use ASP objects and you will have also seen that it is very easy to create components in Visual Basic.

  • Step 12 : Now go to File -> Make Stardeveloper.dll . A small dialogue window will open asking the name of DLL, by default Project name which in this case is Stardeveloper.dll is used. But you should edit it so that it becomes 'CheckBrowser.dll'. And then hit 'ok'.
  • If every thing goes fine then our component with ProgID 'Stardeveloper.CheckBrowser' will be created in the 'CheckBrowser.dll'. On the next page we will create a simple ASP page and make use of our created component.

    Create a new ASP page and name it 'checkbrowser.asp'. Copy and paste the following code into it and then save it :

      <html>
      <head>
       <title>
       Stardeveloper.CheckBrowser Component.
       </title>
       <style>
         body { font-family : Verdana; font-size : 10pt; }
       </style>
      </head>
      <body>
     <%
      ' Declaring variables
      Dim objcb
      Set objcb = Server.CreateObject("Stardeveloper.CheckBrowser")
      ' Using our component's methods to send browser speicific code to the client
      If objcb.IsIE Then
      ' Browser is Microsoft Internet Explorer
      Response.Write "Microsoft Internet Explorer specific code goes here..."
      ElseIf objcb.IsNS Then
      ' Browser is Netscape Navigator
      Response.Write "Netscape Navigator specific code goes here..."
      Else
      ' Browser is neither Internet Explorer nor Navigator
      Response.Write "Code for other browsers goes here..."
      End If
      ' Done. Now destroy the objcb object
      Set objcb = Nothing
     %>
      </body>
      </html>

    Now save the page in a directory from which you can run ASP pages. To run the ASP page e.g. if you have saved the page in directory c:/inetpub/wwwroot/checkbrowser.asp then type http://127.0.0.1/checkbrowser.asp in the URL box of your browser and hit 'enter'. Depending on the type of your browser you will see a browser specific code message displayed on the browser. Try it out yourself and see it working.

    Conclusion
    We learned in this tutorial how to create a component and how to use ASP Intrinsic objects from within the component. We made use of Request object in our methods to determine client browser. This tutorial will have given you enough knowledge to start creating components which use ASP objects and you will have also seen that it is very easy to create components in Visual Basic.


    Previous ( 1 Gone )( No Further Pages )

    See all comments and questions (post-ad) posted for this tutorial.


    Download Associated Files
    2000041401.zip

    Related Articles
    1. Creating an ASP COM Component in Visual Basic

    Comments/Questions ( Threads: 2, Comments: 2 )
      Contains 1 or more replies by the Author of this Article.
      Contains 1 or more replies by Faisal Khan.

    1. If 'MTS Type Library' Reference Is Not Available, use COM+ Services Type Library Instead
    2. 'Microsoft Transaction Server Type Library' Reference Is Not Available. Where can I find it?

    Post Comments/Questions

    In order to post questions/comments, you must be logged-in. If you are not a member yet, then signup, otherwise login. Once you login then come back to this page and you'll see a form right here which will allow you to post comments/questions.

    Please note, one of the benefits of signing up is to be notified immediately by email everytime you receive a reply to the thread you have subscribed to.

     
    © 1999 - 2009 Stardeveloper.com, All Rights Reserved.