How to programmatically change which framework a web site should use

  • Thread starter Thread starter Angelo Brusati
  • Start date Start date
A

Angelo Brusati

Hi everybody

Do you know how to change which framework a web site should use - programmatically?
For example: my web server has both Framework 1.1 and 2.0. My installation/deployment program has to set a specific web site to run under Framework 2.0.

How to do it through ADSI or else?

Thanks in advance.

Greetings,
Angelo Brusati
 
I know the answer, but not all of the implementation steps. You can export a
configuration from IIS by right clicking on the virtual root in question and
exporting the config. Provided the server is set up in a similar manner, the
settings will be easy enough. I do not have an example of the code necessary
to resurrect the settings file, however.

Now, if you do not have control of the production server (example: selling
to the masses), you will want to programatically poke at IIS to ensure 2.0
is there, install if not, etc.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com

*************************************************
Think outside of the box!
*************************************************
Hi everybody

Do you know how to change which framework a web site should use -
programmatically?
For example: my web server has both Framework 1.1 and 2.0. My
installation/deployment program has to set a specific web site to run under
Framework 2.0.

How to do it through ADSI or else?

Thanks in advance.

Greetings,
Angelo Brusati
 
Hi,

The following script adds IIS application mapping to a WEB application.

Use IIS ADSI :

dim shell : set shell = CreateObject("WScript.Shell")

dim vdir : set vdir = GetObject("IIS://LocalHost/W3SVC/1/ROOT")

dim maps : maps = vdir.ScriptMaps

dim aspnetdll : aspnetdll =
shell.ExpandEnvironmentStrings("%WinDir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll")

redim preserve maps(ubound(maps) + 1)

maps(ubound(maps)) = "*" & "," & aspnetdll &
",5,GET,HEAD,POST,TRACE"

vdir.ScriptMaps = maps

vdir.SetInfo()

May be this should help you.

Thank you,
Andrei
 
Hi Andrei

Thanks for your suggestion.
I can see the point, that is to update the ISAPI filter entry that points to
the Framework 2.0 aspnet_isapi.dll.
I should try to remove the existing entries which points to the Framework
1.1 filter, but I can see that this solution doesn't change the ASP.NET tab
of the web site properties in the MMC for IIS.

Any other suggestions?

Greetings,
Angelo Brusati
 
Back
Top