cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
needer
Level 4

How to bind IIS WebSite to combobox

hi everyone, in my project i want user can select website alreadly in IIS, so i can know rebuild or create it, my question is how to bind website with combobox, anybody can help me?:(

PS. i also want to know the same function of Virtual Directory.:confused:
Labels (1)
0 Kudos
(4) Replies
MrSensitive
Level 2

First, create a custom action that executes the following code (VBScript)
actions should run in immediate mode

DIM strServer, strServerType, strServerMetaType
DIM objService
dim msiView,strProp
Const msiViewModifyInsertTemporary = 7

strServer = "localhost"
strServerType = "Web"
strServerMetaType = "W3SVC"

Set objService = GetObject( "IIS://" & strServer & "/" & strServerMetaType )


set msiView = Database.OpenView("SELECT * from ComboBox")
strProp = "WEBSITES"
DIM objServer, strBindings
r = 0
FOR EACH objServer IN objService
IF objServer.Class = "IIs" & strServerType & "Server" THEN
r = r + 1
AddComboItem msiView,strProp,r,objServer.Name,objServer.ServerComment
END IF
NEXT
msiView.Close



function AddComboItem(msiView,strProp,nIndex,strValue,strText)
dim rec
set rec = Installer.CreateRecord(4)
rec.StringData(1) = strProp
rec.IntegerData(2) = nIndex
rec.StringData(3) = strValue
rec.StringData(4) = strText
msiView.Modify msiViewModifyInsertTemporary,rec
end function


then, create two Properties
WEBSITE and WEBSITES

on a form of your choise, add a combobox, and bind it to the property WEBSITES

(important!)
in your Internet Information Services settings, create a default website, as port number you select something random and in site number enter [WEBSITES]



this is the approach that works for me, I compiled it using different posts on the internet,

please not that I do not guarantee a bullet proof setup using this..

not sure on how to do Virtual directories, but a similar approach might be feasable.
0 Kudos
needer
Level 4

Thanx a lot MrSensitive, it's working:D

but there still have a question, when i select one website already exist, the combobox display the site num of this website, i want know how to show Website Name like combobox text is website name and vlaue is web site num~ thanks again.
0 Kudos
ChristopheOce
Level 7

Hi,

i would like to do the same thing but that's doesn't work !!!

I have to create a basic msi project add a custom action vb in store binary table. this custom action is on immediate execution.

On the readytoinstall dialog, i've add a combo box with the property => [WEBSITES].

I have add a button on this dialog with a doAction for execute the custom action when i click on the button.
For Argument i have add the name of the custom action vb and condition is set to 1 !

On property manager i have add this property [WEBSITE] with the value 0.

On internet information service, i have add a web site with the name default web site. For site number i have enter 123 and for site number [WEBSITES]

I build the project and run, when i click on the button on ready to install there is nothing on the combobox !!!!

Something is wrong but if someone can tell me what !?

Thanks for all
Christophe
0 Kudos
needer
Level 4

Christophe

you only need one perporty [WebSite] and change the [WebSites] to [WebSites] in vbs, make sure the combobox is bind with [WebSite], set custom action run after SetupCompleteSuccess and before InstallWelcome, this custom is work on my project.
0 Kudos