Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...