Cannot create ActiveX component. with GetObject

prowla2003

Newcomer
Joined
Jun 18, 2003
Messages
10
Hi,
I'm still new to this so any help will be appreciated.

I have a asp function that I want to copy over to aspx. the function finds the port that a particular web server instance is running on.

this is the asp
---------------------------------------------
function getServerBinding()
dim objWebSite
dim vData
dim sReturn

set objWebSite = GetObject("IIS://localhost/" & mid(Request.ServerVariables("INSTANCE_META_PATH"),5))
vData = objWebSite.ServerBindings

if typename(vdata) = "Variant()" then
sReturn = vData(0)
else
sReturn = vData
end if

getServerBinding = replace(mid(sReturn,instr(sReturn,":")+1),":","")

end function
--------------------------------------------


in aspx

I get Cant create Activex component on the GetObject line
-------------------------------------------------

Private Function getServerBinding() As String

Dim objWebSite As Object
Dim vData As Array
Dim sReturn As String

Dim sMetaPath As String
Dim sObject As String


sMetaPath = Request.ServerVariables("INSTANCE_META_PATH")
sMetaPath = Mid(sMetaPath, 5)
sObject = "IIS://localhost/" & sMetaPath

objWebSite = GetObject(, sObject)

'vData = objWebSite.ServerBindings

'If TypeName(vData) = "Variant()" Then
' sReturn = vData(0)
' Else
' sReturn = vData
'End If

getServerBinding = Replace(Mid(sReturn, InStr(sReturn, ":") + 1), ":", "")

End Function
--------------------------------------------------



I found this bit of code as an explanation for a similar problem but dont know how to use it in my case..

'Dim typeShell As Type = Type.GetTypeFromProgID("Shell.Application")
'Dim objShell As Object = Activator.CreateInstance(typeShell)
'Dim o As Object = typeShell.InvokeMember("Windows", Reflection.BindingFlags.InvokeMethod, Nothing, objShell, Nothing)
'Dim obIe As Object
'For Each obIe In o
'obIe.GetType.InvokeMember("Quit", Reflection.BindingFlags.InvokeMethod, Nothing, obIe, Nothing)
'Next

Thanks for any help...
 
Back
Top