Link to home
Create AccountLog in
Avatar of Gary_Nelson
Gary_Nelson

asked on

Asp.net web service does not identify browser

I make a call from an asp.net page to an asp.net web service and in the web service I have some browser specific code,

HttpContext.Current.Request.UserAgent always returns:
Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client Protocol 2.0.50727.1433)
no matter what browser I use. My guess is that this is by design and that I will have to tell the web service what browser is calling it, buy I'm just wondering if there is another way to do this.
Avatar of BuggyCoder
BuggyCoder
Flag of India image

private void Button1_Click(object sender, System.EventArgs e)
{
HttpBrowserCapabilities bc;
        string s;
        bc = Request.Browser;
s= "Browser Capabilities" + "\n";
            s += "Type = " + bc.Type + "\n";
            s += "Name = " + bc.Browser + "\n";
            s += "Version = " + bc.Version + "\n";
            s += "Major Version = " + bc.MajorVersion + "\n";
            s += "Minor Version = " + bc.MinorVersion + "\n";
            s += "Platform = " + bc.Platform + "\n";
            s += "Is Beta = " + bc.Beta + "\n";
            s += "Is Crawler = " + bc.Crawler + "\n";
            s += "Is AOL = " + bc.AOL + "\n";
            s += "Is Win16 = " + bc.Win16 + "\n";
            s += "Is Win32 = " + bc.Win32 + "\n";
            s += "Supports Frames = " + bc.Frames + "\n";
            s += "Supports Tables = " + bc.Tables + "\n";
            s += "Supports Cookies = " + bc.Cookies + "\n";
            s += "Supports VB Script = " + bc.VBScript + "\n";
            s += "Supports JavaScript = " + bc.JavaScript + "\n";
            s += "Supports Java Applets = " + bc.JavaApplets + "\n";
            s += "Supports ActiveX Controls = " + bc.ActiveXControls + "\n";
        TextBox1.Text = s;

}
reference from: http://support.microsoft.com/kb/311281
ASKER CERTIFIED SOLUTION
Avatar of Gary Davis
Gary Davis
Flag of United States of America image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account