IIS 10.0.14393.0 incorrect user agent detectionRSS

2 replies

Last post Sep 06, 2019 12:26 AM by Rovastar

  • IIS 10.0.14393.0 incorrect user agent detection

    Sep 05, 2019 02:08 PM|bubolski|LINK

    Hello,

    I have asp mvc application. I tried to detect user agent with:

    @if (Request.UserAgent.Contains("Mobi") == true || Request.UserAgent.Contains("Android") == true)

    and with javascript

    alert(navigator.userAgent);

    It's working ok but today I tried to check my app on Samsung Galaxy Tab s2 (SM-T715) and my app doesn't detect any Mobi or Android in user agent.

    My IIS log file detects Mozilla/5.0+(X11;+Linux+x86_64)+AppleWebKit/537.36+ KHTML,+like+Gecko)+Chrome/76.0.3809.132+Safari/537.36

    but i went on my tablet to http://whatsmyuseragent.org and  it shows

    Mozilla/5.0 (Linux; Android 7.0;SM-T715)AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36

    Why I'm getting different user agent, and how I can fix it. It should detect this is mobile/android device but it doesn't. I think it's related to IIS settings.

  • Re: IIS 10.0.14393.0 incorrect user agent detection

    Sep 05, 2019 04:32 PM|lextm|LINK

    bubolski

    My IIS log file detects Mozilla/5.0+(X11;+Linux+x86_64)+AppleWebKit/537.36+ KHTML,+like+Gecko)+Chrome/76.0.3809.132+Safari/537.36

    IIS won't lie. When it wrote that line, it did receive an HTTP request with that user agent string. You can use tools like Wireshark to confirm.

    bubolski

    but i went on my tablet to http://whatsmyuseragent.org and  it shows

    Mozilla/5.0 (Linux; Android 7.0;SM-T715)AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36

    About why it shows another user string to another site, check the web browser configuration. That has nothing to do with IIS.

    Lex Li
    IIS Consulting Services at https://support.lextudio.com/services/consulting.html
    ---------------------------
    This posting is provided "AS IS" with no warranties, and confers no rights.
  • Rovastar Rovastar

    5457 Posts

    MVP

    Moderator

    Re: IIS 10.0.14393.0 incorrect user agent detection

    Sep 06, 2019 12:26 AM|Rovastar|LINK

    I can't explain that either. Check in wireshark for the user agent as Lex says.

    I would expect the online sites to do the same process as in IIS.

    Troubleshoot IIS in style
    https://www.leansentry.com/