Asp components Intermediate entry and one of the master

  Junior Guide wrote seven, and certainly there are still some things need to write the primary, I will gradually be supplemented 

  Intermediate Course contents: 

  This may also be the greatest concern of all: such as: the operation of the database and packaging.    Asp the use of built-in object.    I will spend part of the longer length to show that this part of the contents of need you can more skilled use ADO database and the asp operation of the five major targets are more familiar with. 

  We look at the spread of the Internet compared some of the information: 

  As we all know, the ASP-Response, Request, Server, Session, Application five targets, five built-in fact, this is precisely target IIS console ActiveX DLL initialization of the five components that can be initialized five IIS ASP component for the course, we can direct our ActiveX DLL in the application of these components to achieve our programming, in other words, we can VB applications through the use of these components to achieve visit within ASP Purchase object function. 

  As long as you have a PWS4 or IIS4 above WEB server, you should have a title called "Microsoft Active Server Pages Object" for the object, we can ActiveX DLL in the VB application of the use of this object, through the use of this object, We acquired an object (): ScriptingContext, this object is precisely our entire article on the core object.    The relationship between the stored object as follows: 

  Members of the class of objects 

  ASPTypeLibrary ScriptingContext Application 

Request

Response

Session

Server

  Through the above diagram, we can easily understand ScriptingContent category. 

  Below we look at a specific example: 

  Open vb6, Activex Dll new projects.    Works were revised to fCom, class name was revised to fZ1 
  Quote "Microsoft Active Server Pages Object" object library. 
  The creation of two components events: OnStartPage and OnEndPage 
  OnStartPage the incident created a category ScriptingContent invoked. 
  Examples of the type ScriptingContent. 

  Code as follows: 
  Option Explicit 

  'Object statement 

  Dim myResponse As Response 

  Dim myRequest As Request 

  Dim myApplication As Application 

  Dim myServer As Server 

  Dim mySession As Session 

  'When the component is created when this incident will trigger 

  Public Sub OnStartPage (myScriptingContent As ScriptingContext) 

  'To the object instantiation 

  Set myResponse = myScriptingContent.Response 

  Set myRequest = myScriptingContent.Request 

  Set myServer = myScriptingContent.Server 

  Set myApplication = myScriptingContent.Application 

  Set mySession = myScriptingContent.Session 

  MyResponse.Write "ActiveX DLL component has been created!" 

  End Sub 

  'When the components were destroyed when this incident triggered 

  Public Sub OnEndPage () 

  MyResponse.Write "ActiveX DLL components have been destroyed." 

  'Destruction of target 

  Set myResponse = Nothing 

  Set myRequest = Nothing 

  Set myServer = Nothing 

  Set myApplication = Nothing 

  Set mySession = Nothing 

  End Sub 

  'Definition of a component of our own way 

  Public Sub HelloWorld () 

  MyResponse.Write "This is the built-in object used to write asp" 

  End Sub 


  Test 

  Open visual interdev6.0, generate a document asp 

  <% @ Language VBScript% => 

<HTML>

<BODY>

<%

  Set obj = server.CreateObject ( "fCom.fZ1") 

  Call obj.HelloWorld () 

%>

  </ BODY> 

  </ HTML> 

  Configured virtual directory, ie asp in the implementation of this document are as follows: 

  ActiveX DLL component has been created! This is the built-in object used to write the asp ActiveX DLL components have already been destroyed! 

Bookmark it: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Sphinn
  • del.icio.us
  • Google
  • DotNetKicks
  • DZone
  • Furl
  • Netvouz

Tags: , ,

Releated Articles


0 Comments to “Asp components Intermediate entry and one of the master”

No Comments. Send your comment.

Leave a Reply

You must be logged in to post a comment.