Results 1 to 10 of 10

Thread: How to check browser version

  1. #1
    Lively Member
    Join Date
    Aug 09
    Posts
    105

    Post How to check browser version

    I have a website that I want to restrict only to Internet Explorer, how do I do that? Code is ASP.net

  2. #2
    Addicted Member Claude2005's Avatar
    Join Date
    Jan 10
    Location
    Philippines
    Posts
    166

    Re: How to check browser version

    Hi there,

    Have you tried these?

    Code:
    Dim browserName As String = Request.Browser.Browser
    Dim browserVersion As String = Request.Browser.Version

  3. #3
    Addicted Member Claude2005's Avatar
    Join Date
    Jan 10
    Location
    Philippines
    Posts
    166

    Re: How to check browser version

    Hi there,

    Also, why do you want to restrict your application to Internet Explorer only?

  4. #4
    Lively Member
    Join Date
    Aug 09
    Posts
    105

    Re: How to check browser version

    Because the master page doesn't line up right in other browsers and everyone has Internet Explorer, and it loads fine in IE

  5. #5
    Lively Member
    Join Date
    Aug 09
    Posts
    105

    Re: How to check browser version

    Quote Originally Posted by Claude2005 View Post
    Hi there,

    Have you tried these?

    Code:
    Dim browserName As String = Request.Browser.Browser
    Dim browserVersion As String = Request.Browser.Version
    No I haven't simply because that doesn't look like it's going to reject any other browser, will it?

  6. #6
    Addicted Member Claude2005's Avatar
    Join Date
    Jan 10
    Location
    Philippines
    Posts
    166

    Re: How to check browser version

    Because the master page doesn't line up right in other browsers and everyone has Internet Explorer, and it loads fine in IE
    I don't have that kind of problem with master pages, maybe you're not coding or doing it in a correct way, since Internet Explorer is the only browser that displays it correctly. I suggest you visit www.w3schools.com so you can look up on how to code your web pages correctly so that all major browsers can display your pages correctly.

    No I haven't simply because that doesn't look like it's going to reject any other browser, will it?
    What do you mean?
    Last edited by Claude2005; Jun 9th, 2010 at 12:52 AM. Reason: typo

  7. #7
    Addicted Member Claude2005's Avatar
    Join Date
    Jan 10
    Location
    Philippines
    Posts
    166

    Re: How to check browser version

    No I haven't simply because that doesn't look like it's going to reject any other browser, will it?
    After reading it again, here's the code again on my first post

    Code:
    Dim browserName As String = Request.Browser.Browser
    Dim browserVersion As String = Request.Browser.Version
    To answer your question, it's a no. I just gave you this in order for you to have a head start. You could just tell me if you don't know what to do with that code. So here's some addition to the code above...

    Code:
    If browserName = "IE" Then
        'Do what you want here
    Else
        'Do what you want here
    End If

  8. #8
    Lively Member
    Join Date
    Aug 09
    Posts
    105

    Re: How to check browser version

    I hate to be a pain, but how do I display a Message or even just a webpage (I am used to VB.net where I would say Page1.show, but that doesn't work in ASP.net) to the user if they're not using Internet Explorer?

  9. #9
    Addicted Member Claude2005's Avatar
    Join Date
    Jan 10
    Location
    Philippines
    Posts
    166

    Re: How to check browser version

    Hi there,

    Hmm, do you know HTML? It's a good start to learn HTML first before going to ASP.NET. You could do HTML on the aspx pages to display static information.

  10. #10
    ASP.NET Moderator gep13's Avatar
    Join Date
    Nov 04
    Location
    The Granite City
    Posts
    21,742

    Re: How to check browser version

    Hey,

    Ok, you are going about this in completely the wrong way (in my opinion).

    So your master page doesn't line up correctly in other browsers, how about you fix that problem, rather than preventing users from seeing your site if they are not using IE. You would be cutting traffic to your site greatly if you do this.

    Although I have IE installed, for testing purposes, I use Chrome as my default browser, and I wouldn't want to have to open IE just to see a site that only works in IE, and I am sure I am not alone in this.

    Gary

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •