Click here to Skip to main content
15,890,043 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to detect request coming from which source like IOS or ANDROID SYSTEM.

FOR EXAMPLE IF REQUEST IS COMING FROM IPHONE THEN RETURN IOS
IF REQUEST IS COMING FROM ANDROID PHONE THEN RETURN ANDROID

PLEASE GIVE ME CODE FOR ABOVE REQUIREMENT.

THANKS
Posted
Comments
F-ES Sitecore 4-Dec-15 5:12am    
What request? Are you talking about page requests to a web server? If so check the user agent header. There are places you get get lists of the common user agents for each device if you google. Some provide basic lists for free, others provide comprehensive ones for a price.

http://stackoverflow.com/questions/5155479/how-do-i-check-if-the-useragent-is-an-ipad-or-iphone
George Jonsson 4-Dec-15 5:15am    
And why the capital letters?
And why would anyone just give you the code?

1 solution

check How to: Detect Browser Types and Browser Capabilities in ASP.NET Web Forms[^]
C#
private void Button1_Click(object sender, System.EventArgs e)
{
    System.Web.HttpBrowserCapabilities browser = Request.Browser;
    string s = "Browser Capabilities\n"
        + "Type = "                    + browser.Type + "\n"
        + "Name = "                    + browser.Browser + "\n"
        + "Version = "                 + browser.Version + "\n"
        + "Major Version = "           + browser.MajorVersion + "\n"
        + "Minor Version = "           + browser.MinorVersion + "\n"
        + "Platform = "                + browser.Platform + "\n"
        + "Is Beta = "                 + browser.Beta + "\n"
        + "Is Crawler = "              + browser.Crawler + "\n"
        + "Is AOL = "                  + browser.AOL + "\n"
        + "Is Win16 = "                + browser.Win16 + "\n"
        + "Is Win32 = "                + browser.Win32 + "\n"
        + "Supports Frames = "         + browser.Frames + "\n"
        + "Supports Tables = "         + browser.Tables + "\n"
        + "Supports Cookies = "        + browser.Cookies + "\n"
        + "Supports VBScript = "       + browser.VBScript + "\n"
        + "Supports JavaScript = "     + 
            browser.EcmaScriptVersion.ToString() + "\n"
        + "Supports Java Applets = "   + browser.JavaApplets + "\n"
        + "Supports ActiveX Controls = " + browser.ActiveXControls 
              + "\n"
        + "Supports JavaScript Version = " +
            browser["JavaScriptVersion"] + "\n";

    TextBox1.Text = s;
}
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900