Reply to comment
Change IIS ASP.NET Framework Version Programatically
I searched a good deal for a simple and easy way to change the target ASP.NET framework version for a Virtual Directory in IIS. To manually do this, you would normally open IIS and right-click the Virtual Directory you wanted to configure settings for. Then select Properties and you would be presented with a dialog like this:

To configure this setting programatically, you can use the application:
aspnet_regiis.exe
Here is the command to set a virtual directory to a specific framework version:
\windows\microsoft.net\framework\v2.0.50727\aspnet_regiis.exe -s "w3svc/1/root/MyVirtualDirectoryName"
Where "MyVirtualDirectoryName" is the name of the virtual directory that you are changing settings for.
Here is a snippet of VBScript that runs changes the IIS ASP.NET framework version when run. This could be included in an installer or used to easily configure a server automatically:
Set WshShell = WScript.CreateObject("WScript.Shell")WshShell.Run("\windows\microsoft.net\framework\v2.0.50727\aspnet_regiis.exe -s " & Chr(34) & "w3svc/1/root/WBID" & Chr(34), 1, TRUE)Save this script in a text file with a .vbs extension, then double click it to run the script.
Reply
Popular Articles
Last viewed:
- Getting Started with Microsoft Chart Controls for ASP.NET 3.5
- GridView ObjectDataSource LINQ Paging and Sorting
- Data Access Layer using SqlDataReader and C#
- Disable Button on Submit (Prevent multiple submits)
- Fixing Relative Paths in C# ASP.NET When Using Url Rewriting
- Clustered Index vs. Non-Clustered Index in SQL Server

Recent comments
14 hours 23 min ago
1 day 14 hours ago
3 days 15 hours ago
4 days 4 hours ago
4 days 15 hours ago
4 days 21 hours ago
5 days 1 hour ago
1 week 21 hours ago
1 week 1 day ago
1 week 4 days ago