Summary
Add bool IsBrowser(string browserName) method to HttpCapabilitiesBase.cs. For our use case it would be enough to just have
public bool IsBrowser(string browserName) => string.Equals(Browser, browserName, StringComparison.OrdinalIgnoreCase);
in HttpCapabilitiesBase.
But as I have understood the original implementation is hierarchical so that when running Chrome these all would return true
IsBrowser("Default")
IsBrowser("Mozilla")
IsBrowser("WebKit")
IsBrowser("Chrome")
Which approach would you like to go with?
Motivation and goals
We are migrating an ASP.NET application to CoreWebForms. We use Telerik UI and some of their components such as RadAjaxLoadingPanel depends on using System.Web.Configuration.HttpCapabilitiesBase.IsBrowser(System.String) to check if the user is running on IE 7. Adding IsBrowser to HttpCapabilitiesBase would help us greatly with the migration.
Example:
System.MissingMethodException: Method not found: 'Boolean System.Web.Configuration.HttpCapabilitiesBase.IsBrowser(System.String)'.
at Telerik.Web.SkinRegistrar.RegisterStyleSheetReference(ISkinnableControl control, StyleSheetReference reference, StringBuilder cssRegs, Type controlToRegisterType)
In scope
public bool IsBrowser(string browserName) method to HttpCapabilitiesBase
Optionally:
- Implement
AddBrowser(string browser) at BrowserCapabilitiesFactory to allow hierarchical matching
- Unit tests for hierarchical matching
Out of scope
Optionally hierarchical matching
Risks / unknowns
Not implementing hierarchical matching can cause code to silently take another path when using SystemWeb Adapters
Examples
HttpContext.Current.Request.Browser.IsBrowser("IE")
Summary
Add
bool IsBrowser(string browserName)method to HttpCapabilitiesBase.cs. For our use case it would be enough to just havein
HttpCapabilitiesBase.But as I have understood the original implementation is hierarchical so that when running Chrome these all would return true
Which approach would you like to go with?
Motivation and goals
We are migrating an ASP.NET application to CoreWebForms. We use Telerik UI and some of their components such as
RadAjaxLoadingPaneldepends on usingSystem.Web.Configuration.HttpCapabilitiesBase.IsBrowser(System.String)to check if the user is running on IE 7. AddingIsBrowsertoHttpCapabilitiesBasewould help us greatly with the migration.Example:
In scope
public bool IsBrowser(string browserName)method toHttpCapabilitiesBaseOptionally:
AddBrowser(string browser)at BrowserCapabilitiesFactory to allow hierarchical matchingOut of scope
Optionally hierarchical matching
Risks / unknowns
Not implementing hierarchical matching can cause code to silently take another path when using SystemWeb Adapters
Examples