Global.asa, COM, ASP

Results 1 to 2 of 2

Thread: Global.asa, COM, ASP

  1. #1
    Join Date
    Dec 1969

    Default Global.asa, COM, ASP

    Hi <BR><BR>I am using COM objects together with ASP, and use following following code on pages: <BR><BR> <BR>Set ASPObj = Server.CreateObject("Project1.MyType")<BR> <BR> ASPObj.MyMethod<BR><BR>Set ASPObj = Nothing <BR><BR><BR>Would it be possible to somehow put Set ASPObj = Server.CreateObject("Project1.MyType") into Global.asa Application_OnStart? <BR><BR>and Set ASPObj = Nothing into Global.asa Application_OnEnd sub? <BR><BR>I tried but had some problems with it. <BR>I thing writing the same code on each page is not wise, what would be a better way to organize it? Would it be wise to put it into Global.asa? <BR><BR>Thanks, <BR>Raigo

  2. #2
    Join Date
    Dec 1969

    Default Never do this

    COM objects should not be placed in Application or Session variables because most are not free threaded. You should create, use, and then destroy your COM objects as needed in each page. Do not force IIS to hold on to objects any longer than they are necessary.<BR><BR>This message brought to you by Windows and the letters D N A<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts