Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Limiting ASP.net application to just Windows

Options
  • 28-06-2021 2:49pm
    #1
    Registered Users Posts: 4,799 ✭✭✭


    Is there a setting to just allow an ASP.net application to run on Windows and exclude mobile devices and Apple? Maybe going to a generic error page when the wrong device is chosen.
    The compliance people have said if we allow IPhones and Galaxy, they have to be fully tested on both platforms. We don't have the testing resources to do that.


Comments

  • Registered Users Posts: 68,317 ✭✭✭✭seamus


    Yes, you can query the User-Agent header sent by the browser.

    https://docs.microsoft.com/en-us/dotnet/api/system.web.httprequest.useragent?view=netframework-4.8

    It's not an exact science, the user-agent is basically a freetext field so the browser could send anything. But 99% of your traffic will be identifiable by platform.


  • Registered Users Posts: 4,799 ✭✭✭10000maniacs


    Thanks Seamus


  • Registered Users Posts: 10,460 ✭✭✭✭28064212


    Would strongly recommend against doing that. User-agent restrictions are years out of date, and weren't a good idea even when they were common. You're almost certain to get both false positives and false negatives, and you end up with a game of whack-a-mole maintaining a ever-increasing list of black and whitelists.

    Sounds like your compliance people don't know their arse from their elbow tbh. You don't deliberately break a site based on what you think a user might be running. You publish a whitelist of supported configurations, (Windows 7+, Firefox 78+/Chrome 90+/IE6+ (joke!), resolution 1024x600 etc.), and then don't provide any support for users outside those. If it works for them anyway, great, if not, they're on their own until they switch to a supported config.

    Boardsie Enhancement Suite - a browser extension to make using Boards on desktop a better experience (includes full-width display, keyboard shortcuts, and dark mode). Now available through the extension stores

    Firefox: https://addons.mozilla.org/addon/boardsie-enhancement-suite/

    Chrome/Edge/Opera: https://chromewebstore.google.com/detail/boardsie-enhancement-suit/bbgnmnfagihoohjkofdnofcfmkpdmmce



  • Registered Users Posts: 4,799 ✭✭✭10000maniacs


    28064212 wrote: »
    Would strongly recommend against doing that. User-agent restrictions are years out of date, and weren't a good idea even when they were common. You're almost certain to get both false positives and false negatives, and you end up with a game of whack-a-mole maintaining a ever-increasing list of black and whitelists.

    Sounds like your compliance people don't know their arse from their elbow tbh. You don't deliberately break a site based on what you think a user might be running. You publish a whitelist of supported configurations, (Windows 7+, Firefox 78+/Chrome 90+/IE6+ (joke!), resolution 1024x600 etc.), and then don't provide any support for users outside those. If it works for them anyway, great, if not, they're on their own until they switch to a supported config.

    I eventually ended up using:
    HTTPBrowserCapabilities = HTTPContext.Current.Request.Browser + Platform()
    All modern Windows Operating systems return "WinNT" on that call.


Advertisement