6

I have a web server that is run by a third party. I don't have direct access to the server but I can deploy ASP.NET code to it. I want to detect if that server is running ASP.NET 4 / .NET 4 or not. What is the easiest way to do that? Is there an environmental property somewhere that would tell me? Or should I try to load a particular class that only exists in .NET 4?

2
  • 2
    How's about just asking the third party? Commented Sep 20, 2010 at 13:23
  • You'd think that would be easy, wouldn't you? But I have reason to not trust anything they tell me. :-) Commented Sep 20, 2010 at 14:01

2 Answers 2

7

How about printing System.Environment.Version?

Sign up to request clarification or add additional context in comments.

2 Comments

That seems to work. I created a stand-alone test page with a <%= System.Environment.Version %> in it. My only question is, let's say I put that in a folder alongside an existing application with a web.config that was for .NET 3.5. What version would it show?
Nevermind that was a stupid question. It would show whatever version of ASP.NET that IIS virtual folder is configured as.
2

http://msdn.microsoft.com/en-us/library/system.environment.version.aspx

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.