I need to get client stats for browser (not full long description but short names, generally firefox,ie6,ie7,ie8,safari,chrome,opera and mozilla). Client resolution and OS ie. Windows Vista, Ubuntu ....
thanks
You can get the browser name using Request.Browser.Browser
. There's also a lot more in the Request.Browser
class that may be of interest:
var browserName = Request.Browser.Browser; // Would return IE, etc
var browserType = Request.Browser.Type; // Would return IE7, IE8, etc.
var browserMajor = Request.Browser.MajorVersion;
var browserMinor = Request.Browser.MinorVersion;
var supportsActiveX = Request.Browser.ActiveXControls;
var inputType = Request.Browser.InputType;
var supportsColours = Request.Browser.IsColor;
var isMobileDevice = Request.Browser.IsMobileDevice;
var supportsJavaApplets = Request.Browser.JavaApplets;
var ...
Because ASP.Net is a server side language, it has no visiblity of the client machine's OS settings. Therefor the only way to get the Client OS Resolution would be to use JS and pass the resolution back either as a URL parameter or within a hidden field:
var resolution = screen.width + ' x ' + screen.height;
hiddenField.value = resolution;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With