BrowserHelpers Class

Provides a way to specify custom browser (user agent) information.

System::Object
  System.Web.WebPages::BrowserHelpers

Namespace:  System.Web.WebPages
Assembly:  System.Web.WebPages (in System.Web.WebPages.dll)

[ExtensionAttribute]
public ref class BrowserHelpers abstract sealed

The BrowserHelpers type exposes the following members.

  NameDescription
Public methodStatic memberClearOverriddenBrowserRemoves any overridden user agent for the current request.
Public methodStatic memberGetOverriddenBrowserReturns the browser capabilities object for the overridden browser capabilities or for the actual browser if no override has been specified.
Public methodStatic memberGetOverriddenUserAgentReturns the overridden user agent value or the actual user agent string if no override has been specified.
Public methodStatic memberGetVaryByCustomStringForOverriddenBrowser(HttpContext)Gets a string that varies based on the type of the browser.
Public methodStatic memberGetVaryByCustomStringForOverriddenBrowser(HttpContextBase)Gets a string that varies based on the type of the browser.
Public methodStatic memberSetOverriddenBrowser(HttpContextBase, String)Overrides the request's actual user agent value using the specified user agent.
Public methodStatic memberSetOverriddenBrowser(HttpContextBase, BrowserOverride)Overrides the request's actual user agent value using the specified browser override information.
Top

This class lets your application treat requests as if they were coming from a different browser (user agent) than the one that the user actually made the request from. You invoke the methods of this class using the current page context, as in the following example:

Context.SetOverriddenBrowser(BrowserOverride.Mobile)

Because you invoke the methods from the current context, you do not have to pass the context to those methods when the method expects it.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show: