I assume you are on IIS5.x or 6.0:
There is no good programmatic way to do this. The simplest way is to call out to "%windir%\microsoft\framework\v2.0.50727\aspnet_regiis.exe". Have a look at the -s and -sn options.
In IIS7 the ASP.NET version is set on an ApplicationPool and you simply move applications into different AppPools if you want to run a different ASP.NET version.
Hope this helps.