ASP.NET MVC 4 provides a new feature called Browser Overriding.Browser Overriding API helps us lets your application treat requests as if they were coming from a different browser (user agent) than the one they’re actually from.

Browser Overriding API provides few extension methods for
HttpContext class,  the method are part of BrowserHelpers class in System.Web.WebPages namespace.



The following helper method are use full from switching between one browser mode to other browser mode, overriding the actual browser etc.

- HttpContext.ClearOverriddenBrowser()

Removes any overridden user agent for the current request.

- HttpContext.GetOverriddenBrowser()

Returns an HttpBrowserCapabilitiesBase instance that corresponds to the user agent currently set for the request (actual or overridden). You can use this value to get properties such as IsMobileDevice, Type, Id, MajorVersion, MinorVersion, Tables, etc.

- HttpContext.GetOverriddenUserAgent()

Returns the request’s user agent override value, or the actual user agent string if no override has been specified.

- HttpContext.SetOverriddenBrowser(BrowserOverride browserOverride)

Overrides the request’s actual user agent value using the specified BrowserOverride enum value (BrowserOverride.Desktop / BrowserOverride.Mobile).

- HttpContext.SetOverriddenBrowser(userAgentString)

Overrides the request’s actual user agent value using the specified user agent.

- HttpContext.GetVaryByCustomStringForOverriddenBrowser()