Home All Groups Group Topic Archive Search About

How to programmatically change which framework a web site should use

Author
26 Sep 2006 7:33 AM
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

Author
26 Sep 2006 12:13 PM
Cowboy (Gregory A. Beamer)
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!
*************************************************
"Angelo Brusati" <ang***@intrasuite.net> wrote in message
news:eaGc83T4GHA.3644@TK2MSFTNGP03.phx.gbl...
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
Author
26 Sep 2006 9:55 PM
Andrei Varanovich
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

Angelo Brusati wrote:
Show quote
> 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
>
> ------=_NextPart_000_0006_01C6E14E.C46F6050
> Content-Type: text/html; charset=iso-8859-1
> Content-Transfer-Encoding: quoted-printable
> X-Google-AttachSize: 1163
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> <HTML><HEAD>
> <META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
> <META content="MSHTML 6.00.2900.2963" name=GENERATOR>
> <STYLE></STYLE>
> </HEAD>
> <BODY>
> <DIV><FONT face=Arial size=2>Hi everybody</FONT></DIV>
> <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
> <DIV><FONT face=Arial size=2>Do you know how&nbsp;to change which framework a
> web site should use - programmatically?</FONT></DIV>
> <DIV><FONT face=Arial size=2>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.</FONT></DIV>
> <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
> <DIV><FONT face=Arial size=2>How to do it through ADSI or else?</FONT></DIV>
> <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
> <DIV><FONT face=Arial size=2>Thanks in advance.</FONT></DIV>
> <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
> <DIV><FONT face=Arial size=2>Greetings,</FONT></DIV>
> <DIV><FONT face=Arial size=2>Angelo Brusati</FONT></DIV>
> <DIV>&nbsp;</DIV></BODY></HTML>
>
> ------=_NextPart_000_0006_01C6E14E.C46F6050--
Author
28 Sep 2006 11:32 AM
Angelo Brusati
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


Show quote
"Andrei Varanovich" <dotne***@gmail.com> wrote in message
news:1159307742.623206.301130@i42g2000cwa.googlegroups.com...
> 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
>
> Angelo Brusati wrote:
>> 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
>>
>> ------=_NextPart_000_0006_01C6E14E.C46F6050
>> Content-Type: text/html; charset=iso-8859-1
>> Content-Transfer-Encoding: quoted-printable
>> X-Google-AttachSize: 1163
>>
>> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
>> <HTML><HEAD>
>> <META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
>> <META content="MSHTML 6.00.2900.2963" name=GENERATOR>
>> <STYLE></STYLE>
>> </HEAD>
>> <BODY>
>> <DIV><FONT face=Arial size=2>Hi everybody</FONT></DIV>
>> <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
>> <DIV><FONT face=Arial size=2>Do you know how&nbsp;to change which
>> framework a
>> web site should use - programmatically?</FONT></DIV>
>> <DIV><FONT face=Arial size=2>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.</FONT></DIV>
>> <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
>> <DIV><FONT face=Arial size=2>How to do it through ADSI or
>> else?</FONT></DIV>
>> <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
>> <DIV><FONT face=Arial size=2>Thanks in advance.</FONT></DIV>
>> <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
>> <DIV><FONT face=Arial size=2>Greetings,</FONT></DIV>
>> <DIV><FONT face=Arial size=2>Angelo Brusati</FONT></DIV>
>> <DIV>&nbsp;</DIV></BODY></HTML>
>>
>> ------=_NextPart_000_0006_01C6E14E.C46F6050--
>

AddThis Social Bookmark Button