1

How do I get the string name of the browser (Chrome, Mozilla Firefox, ...) which Visual Studio opens when executing a WCF service?

I'm using Visual Studio 2012

The problem is that I'm using curl to test my service, and browser name is unknown when I use

HttpRequest Request = HttpContext.Current.Request;

string Browser = Request.Browser.Browser.ToString();

When I run my WCF Service it opens a browser. How do I get that browser name in Program?

4

1 回答 1

0
    if (Request.Browser.Type.Contains("IE")) // replace with your check
{
    ...
} 
else if (Request.Browser.Type.ToUpper().Contains("Chrome")) // replace with your check
{
    if (Request.Browser.MajorVersion  < v1)
    { 
        DoSomething(); 
    }
    ...
}
else { }
于 2012-12-03T04:00:43.060 回答