Getting the current .NET version

I've just about finished the upgrade to .NET 2 for the blog software and the removal of proprietary E3 libraries. I want to make sure there is no downtime, but I have to ask the hosting company to change the .NET version of my site. In order to provide "a smooth and orderly transition" between versions, the site would detect which version of .NET is running currently and then redirect to the old code if .NET 1.1 and use the new code as soon as the change takes place.

I've just about finished the upgrade to .NET 2 for the blog software and the removal of proprietary E3 libraries. I want to make sure there is no downtime, but I have to ask the hosting company to change the .NET version of my site. In order to provide "a smooth and orderly transition" between versions, the site would detect which version of .NET is running currently and then redirect to the old code if .NET 1.1 and use the new code as soon as the change takes place. To that end I need to get the current .NET version number. This can be obtained using:

Environment.Version

The Environment object has some other useful methods/properties for identifying operating system etc. which are detailed in this article.

About the Author

Steve Temple, Technical Director and co-founder of Gibe

Steve is Gibe's technical director and super brain behind the development of our major projects. With over 28 years of commercial experience, Steve is an expert in .NET, Umbraco and Microsoft technologies. Steve is also an Umbraco Certified Master and Microsoft MCSD