I don't understand why getting userAgent seems so complicated in .NET..
in JSP you can get userAgent with just one line of code:
String userAgent = request.getHeader("user-agent");
in .Net it seems things are a bit more complicated (what a surprise...;-)
searched for .NET userAgent, this was one of the first results
http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.useragent.aspx (need in C#)
from above url:
myHttpWebRequest.UserAgent = ".NET Framework Test Client"; // EXCUSE ME????
sorry don't get this.. is there a simpler way to get userAgent with .NET 3.5/C#???
If you're using MVC it's just Request.UserAgent inside your controller action. Not sure about WebForms but it's probably the same/similar.
I'm not using MVC..
It is the same for webforms.
Example you saw is for setting the user agent when making a http request.