Instead of detecting and enabling a browser type, consider these two suggestions:
Add custom request headers
In your various subscribers, define a new custom header in the Http request.
HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(url); webRequest.Headers.Add("CallerType", "ClientApp"); // "Browser", etc.
Then you know exactly what type of client is calling. It would be hard to make a mistake and could not be faked / mistaken.
Include Caller Type in QueryString
myService.asmx?BrowserType=1
Add a simple new query parameter for your .asmx web method. This will work the exact same way in a controlled environment, but if other users / developers make mistakes or misrepresent the expected values, you will have to take other measures to correct / process it.
Both allow you to easily define connString for an input value. Perhaps the lack of a modifier / header, you could accept the default value. Your sample question has 2 main results, and the proposed solution will be easily distributed (browser, client application, iPhone, whathaveyou).
source share