0

I need to simulate some JavaScript code using C#. In particular, I need to write some code in C# that'd parallel some functionalities of the Navigator object in JavaScript.

This site introduces the Navigator object in the JavaScript library. http://www.w3schools.com/jsref/obj_navigator.asp

Is there a method/function in the C# library that'd simulate the JavaScipt method navigator.userAgent? (for reference: http://www.w3schools.com/jsref/prop_nav_useragent.asp)

How about navigator.language? ( http://www.w3schools.com/jsref/prop_nav_language.asp )

In fact, which methods in the Navigator object can be simulated by C#? And which ones cannot?

Thank you!!

user3213711
  • 145
  • 2
  • 3
  • 11
  • See http://stackoverflow.com/questions/3057328/httpwebrequest-useragent-what-does-it-do – Keith Payne Jun 12 '14 at 00:44
  • Can you explain in what sense you need to "simulate" navigator objects? Are you trying to create web requests that match once send by browsers? – Alexei Levenkov Jun 12 '14 at 00:57
  • Alexei Levenkov: I mean the corresponding code in C# should produce the same result/output as the code in JavaScript (which uses the Navigator object). So I need methods/functions in the C# library that would parallel the functionality of the Navigator object in JavaScript. Thank you. – user3213711 Jun 12 '14 at 16:31

1 Answers1

1

It sounds like you are after Browser Types and Capabilites. These are avaiable in the Request object:

Request.Browser
Jon P
  • 19,442
  • 8
  • 49
  • 72