PDA

Click to See Complete Forum and Search --> : detect framework on the client?


kleinma
Apr 5th, 2005, 09:56 AM
is there a way via ASP.NET to detect if the client viewing the webpage has the .net framework installed?

basically i am going to be offering a program for download on the web, and i was hoping when they visit the download page, i can display one of 2 links depending on if they have the framework installed or not.

one would be the smaller install of just my app, while the other would be my app and the framework

MrGTI
Apr 5th, 2005, 03:02 PM
How about something like this to get you started,....

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
Dim sBrowserString As String = Request.ServerVariables("HTTP_USER_AGENT")
If sBrowserString.IndexOf(".NET CLR 1.1") > 0 Then
Label1.Text = "The .NET Framework is installed"
End If
End Sub

kleinma
Apr 5th, 2005, 03:16 PM
hmmm thanks MrGTI,

do you know of any other method that might work on NON IE browsers as well?

While most of the target audience will be using IE, some may have firefox/netscape, or even the AOL web browser.. I haven't testing all of these, but in firefox this is what the HTTP_USER_AGENT comes up with

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.6) Gecko/20050317 Firefox/1.0.2

IE comes up with this
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 1.0.3705; .NET CLR 2.0.40607)

Danial
Apr 5th, 2005, 04:20 PM
You should use

System.Environment.Version



Hope it helps.

kleinma
Apr 5th, 2005, 04:52 PM
You should use

System.Environment.Version



Hope it helps.
wont that return the version of the framework on the server running the ASP page? and not the version of the framework running on the client?

code like that runs in the code behind which means the page has not been sent to the client yet anyway

Danial
Apr 5th, 2005, 06:23 PM
wont that return the version of the framework on the server running the ASP page? and not the version of the framework running on the client?

code like that runs in the code behind which means the page has not been sent to the client yet anyway

Sorry, didnt read the post properly thought you need to retrive the Version of Local/Server. :blush:

As for client machine, The BrowserCapability class comes with a property called ClrVersion e.g
Response.Write(System.Web.HttpContext.Current.Request.Browser.ClrVersion.ToString());
The thing is that it only works in IE 5.0 and Greater. It does not work in FireFox, just tested it.

Sorry couldnt be much of a help.

kleinma
Apr 5th, 2005, 11:42 PM
it may be that there just is not a way to detect this from the web.. I guess I can always check for the framework, and if its not IE, i will just have to give alternate options...

MrGTI
Apr 6th, 2005, 10:23 AM
I never include the framework in my installs. (makes them too large :eek: )

I always list the .NET Framework as a system requirement on my pages that have software downloads (http://www.pharfruminsain.com/programs/grethor.asp). That way they are required to get the most recent version from Windows Update. ;)

kleinma
Apr 7th, 2005, 09:12 AM
I never include the framework in my installs. (makes them too large :eek: )

I always list the .NET Framework as a system requirement on my pages that have software downloads (http://www.pharfruminsain.com/programs/grethor.asp). That way they are required to get the most recent version from Windows Update. ;)
well if i was making some free app to offer for download on a site i would do that... but this is an app we are getting paid to create, and the end users are not computer savvy people, so i need to make it as painless as possible for them to get up and running