Browse IIS websites questions - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

rn-pro
Posts: 48
Joined: Thu Jun 16, 2011 10:27 am

Browse IIS websites questions

Hi,
Following your (excellent) article [http://www.advancedinstaller.com/user-g ... e-iis.html] I was able to create a new dialog which contains a combo box which will list by install time all IIS-websites installed on the server. Everything runs fine but I have some more questions:

1) The first item in the combo box is always (by install time) empty. Could I configure it somehow to get a text like “Please choose a website…”?
2) Is it possible somehow to set the selected item of this combo box? For most of our customers the website is already created, its name is known and would be really nice if I could select it somehow in the combo box.
3) Question regarding the “IISBrowseOutputMode“ –Property: I’ve used it already to get the physical path of the selected website. But how could I manage if I need more information? I’d need at least: website-name (to be used for IIS-Settings), physical-path (to know where to copy the files for an existing website, because an existing client-configuration may not be changed) and website-URL to call the start page in browser as soon as the installation is done.

Thank you very much,
Razvan
Bogdan
Posts: 2796
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: Browse IIS websites questions

Hi Razvan,
1) The first item in the combo box is always (by install time) empty. Could I configure it somehow to get a text like “Please choose a website…”?
For this you can set an Init Event on the dialog which contains the combo. This will be a SetProperty event which sets the property of your
combo to the desired text. By default no selection is set to the combo by WIndows Installer, but setting it as a described above should make your combo display the desired text.

The "Init Events" tab can be access from the Dialogs page, while the dialog, on which the combo is found, is select from the tree.
2) Is it possible somehow to set the selected item of this combo box? For most of our customers the website is already created, its name is known and would be really nice if I could select it somehow in the combo box.
You can apply exactly the same method as above, simply use a "SetProperty" init event to set the default value of the combo property. Make sure that this action is not overwritten by the above one,
or the other way around. For this you should set correct execution conditions, to exclude the execution of both events during the install.
3) Question regarding the “IISBrowseOutputMode“ –Property:...
Have you tried using the property "IISBrowseShowExtInfo", as explained in the article? Maybe it can help you obtain the desired information.

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
rn-pro
Posts: 48
Joined: Thu Jun 16, 2011 10:27 am

Re: Browse IIS websites questions

Hello Bogdan,
Thank you very much for your very quick answers you’re doing an amazing work there.

Yes, I’ve tested the “IISBrowseShowExtInfo“-property as well.
However, as soon as I activate this property I’ll get all those needed information listed in the combo box and this verbose information will scare for sure our users.

1) Is it possible to activate this “IISBrowseShowExtInfo”-option but still control which information is going to be listed in the websites combo box? Basically I don't want to show there more than the website-name.
2) Is this “verbose”-information also in another property saved? How could I process/parse these valuable information in an own custom action without showing it to my customers?

Thank you very much,
Razvan
Bogdan
Posts: 2796
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: Browse IIS websites questions

Hi Razvan,

I'm afraid there is no other property which contains the information desired. If you set the property "IISBrowseShowExtInfo" you cannot reduce the list of details presented to the user.

An option would be to use a custom action which gets value of the property "IISBrowseComboBox", parses it for the desired and information and then sets into a new property only the web site/vdir names
you want the user to see. The new property would be the one attached to the combo, not the predefined one "IISBrowseComboBox".

For parsing it you can use VBScript or Win32 DLL custom actions.

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
rn-pro
Posts: 48
Joined: Thu Jun 16, 2011 10:27 am

Re: Browse IIS websites questions

Hi Bogdan,

The ideea with a custom action sounds good but there seems to be a problem with the value of the property "IISBrowseComboBox".
I've created a dummy VBScript ScriptInline Custom-Action: MsgBox Session.Property("IISBrowseComboBox")

I've called this 2 times:
- One time directly after DoAction -> BrowseIIS in my dialog's InitEvents. "IISBrowseComboBox"-Property is empty.
- On Next-Button click (after I choose a website in the combo box), it shows me only the name of the selected website. Nothing about all other informations, even if in the combo box are all shown. (check the attached image)

Did I do something wrong?

Thanks,
Razvan
Attachments
BrowseIIS.PNG
BrowseIIS.PNG (26.76 KiB) Viewed 6150 times
Bogdan
Posts: 2796
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: Browse IIS websites questions

Hi Razvan,

After the Next button is pressed is normal for the property to be set only to the value from the combo. However, when you first displayed the messagebox,
after the BrowseIIS custom action, it should have contained all the information.

Can you please send me the aip file configured and the script to support at advancedinstaller dot com so I can take a look?

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Bogdan
Posts: 2796
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: Browse IIS websites questions

Hi Razvan,

Sorry, I made a confusion in the last post and recommended the incorrect property. The one you could use in your scripts is "IISBrowseOutput", as stated in our article.

Our BrowseIIS custom action does not set the property "IISBrowseComboBox" directly, but it sets the values of the combo to which it is attached, this why you obtained the empty message box.

For setting the content of the property "IISBrowseOutput" you need to set the desired value in "IISBrowseOutputMode" property, as you already know. Since you need multiple attributes of the web, and unfortunately and bit OR operation cannot be done on the values set in this property I recommend you set it to obtain for you th physical path, so you can then redirect APPDIR to it.

For the name of the website is quite simple to obtain, as it is the one selected by the user in the combo, so you can just retrieve the value from "IISBrowseComboBox" property, when "Next" button is pushed. For the URL,
you can try to generate it by appending the web site name to the name of the machine where the site is installed, as from what I know (I'm not 100%) this is how the URL is generated.

Another method to obtain all of the above information would be to perform multiple calls to "BrowseIIS" custom action on the Init Events groups. Before each call
you can set the property "IISBrowseOutputMode" to a different value so you can obtain the desired attribute. For example, for the first call you set it to obtain the name and URL, and for the second one the physical path.

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
rn-pro
Posts: 48
Joined: Thu Jun 16, 2011 10:27 am

Re: Browse IIS websites questions

Hi Bogdan,
Thank you very much for all your support. I have played some more with these custom actions and for all those which will need the same thing in the future here is one more explanation about how this could be done.

Very important points:

You can/need to call the BrowseIIS Custom-Action more than one time.
After each call the property “IISBrowseOutput” will be modified and will contain a string which you can parse in your own Custom-Action. This string (“IISBrowseOutput”) looks like a serialized-dictionary which uses as a key the website-name and which contains a value like this: “your_website1_name?website1_property_value, your_website2_name?website2_property_value, …”.

The only one question is which website-property will be listed?
And very important, this is something you can choose by setting the [IISBrowseOutputMode] – Property (according to the documentation) just before calling the BrowseIIS Custom-Action.

Example:
SET IISBrowseOutputMode=2
CALL BrowseIIS
SHOW IISBrowseOutput -> will show a value like “your_website1_name? your_website1_ID, your_website2_name? your_website2_ID”.

At this point you can store this value in your own property and you can use it later.
And go on:

SET IISBrowseOutputMode=1
CALL BrowseIIS
SHOW IISBrowseOutput -> will show a value like “your_website1_name? your_website1_physical_path, your_website2_name? your_website2_physical_path”.

So this way you can find out all information you need grouped by website_name.

Some more helpful points:
- The IISBrowseSelectedValue Property is ONLY SET AFTER YOU CALL the “IISDecodeBrowserResult” CustomAction.
- The value of the property “IISBrowseShowExtInfo” doesn’t influence at all what I wrote above.
- The “IISBrowseComboBox” (if used in your dialog) will contain doesn’t matter what you set in the “IISBrowseOutputMode” always the selected website-name. (The key of the grouped information I’ve described above).
- It seems for me that “IISDecodeBrowserResult” is using the value stored in this “IISBrowseComboBox” and using this value is parsing the “IISBrowseOutput” – String to get its associated value,which will be stored in “IISBrowseSelectedValue”.

This way a chain of custom-action calls like this:

SET IISBrowseOutputMode=1
CALL BrowseIIS
SET IISBrowseComboBox=”my_website_name”
CALL IISDecodeBrowserResult
SHOW IISBrowseSelectedValue

will show you the physical path of “my_website_name”.

By only changing SET IISBrowseOutputMode=7 and repeating the calls you could get the URL and so on.
This seems to work at least in my test project :).

Please correct me if I wrote something wrong but it was never 100% clear for me how all these properties are linked together.

Thank you very much,
Razvan
Bogdan
Posts: 2796
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: Browse IIS websites questions

Hi Razvan,

Thank you for sharing this info with us, I'm sure that other users will find it useful in the future.

If you have other questions/suggestions please don't hesitate to contact us.

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”