Browsing device properties via HttpBrowserCapabiltiesBase are way off. RRS feed

  • Question

  • User1621932393 posted

    Wondering if I am doing something wrong or if there is another solution altogether.

    Here is some testing code I just wrote out:

    HttpBrowserCapabilitiesBase browser = this.Context.Request.Browser;
        var width = browser.ScreenPixelsWidth;
        var height = browser.ScreenPixelsHeight;
        var maxheight = browser.MaximumRenderedPageSize;
        bool mobile = browser.IsMobileDevice;
        string pageUrl = Request.Url.AbsolutePath.ToString();
        if(width < 960)

    I am testing on my development machine which of course is a desktop. My screen resolution is 1920 x 1200. However, my width and height variables are getting set to 640 and 480 respectively. I have tested this in IE and Chrome so far.

    Saturday, August 11, 2012 12:25 AM


All replies