COM object executing location

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Scott Lemen

    #1

    COM object executing location

    Hi,

    I built a COM object in VB .NET 2003 but can't find a way for the COM
    object to determine its executing location. The COM object requires some
    configuration and the COM object must find the configuration file, with will
    be in the same folder as the DLL, but without hard coding the path. The COM
    object will be called from ASP.

    Below are the two solutions I've tried but each triggers an error when
    called from ASP.

    1. Doing a Registry search of HKEY_CLASSES_RO OT for the COM object's CLSID
    to get the BaseCode value but Registry access is prohibited.

    2. Defining an Assembly object to get the CodeBase property:

    Dim ThisAssembly As [Assembly] = _
    System.Reflecti on.Assembly.Get ExecutingAssemb ly

    but it causes "An exception type 'mscorlib: URI formats are not supported' "

    Thank you for whatever help you provide,

    Scott
  • Mattias Sjögren

    #2
    Re: COM object executing location

    Scott,
    [color=blue]
    >2. Defining an Assembly object to get the CodeBase property:
    >
    >Dim ThisAssembly As [Assembly] = _
    >System.Reflect ion.Assembly.Ge tExecutingAssem bly
    >
    >but it causes "An exception type 'mscorlib: URI formats are not supported' "[/color]

    Try checking the Location property instaed of CodeBase.

    Me.GetType().As sembly.Location


    Mattias

    --
    Mattias Sjögren [C# MVP] mattias @ mvps.org
    http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
    Please reply only to the newsgroup.

    Comment

    Working...