Thus, the HttpRequestBase class has a Browser property that returns an HttpBrowserCapabilitiesBase . We are currently using this property in some of our MVC infrastructure code to get things like browser name and number (for output to logs).
We also have an api that uses ServiceStack , and I would like to be able to connect it to our existing infrastructure. The only thing missing is to parse the name and version of the browser from the UserAgent header (which I have thanks to IHttpRequest.UserAgent), but you need a way to parse it.
My question is: is it possible to create an HttpBrowserCapabilitiesBase using only the UserAgent string? The only subtype that I see in msdn is HttpBrowserCapabilitiesWrapper , whose only ctor is another HttpBrowserCapabilitiesBase.
I thought this class probably exclusively parses the UserAgent string, so why not ctor (string)? Is there a subtype, factory, or static method that I don't see that can do this?
As a rule, I just do it for laziness - I donโt want to write / find another UserAgent parser when I know .Net has such an opportunity that they just hide it.
csauve
source share