I needed the ability to do a few extra things with a WebBrowser
control on a .NET Windows Forms Form, and I found it needed some updates.
So, I made a few. I added some JavaScript manipulation, and a configuration class so that it can be tweaked a lot. I wanted to be able to add and execute arbitrary JavaScript, as well as change how it acts. (By default, it works in Internet Explorer 7 mode, which is dumb. So I figured I would implement all the Feature Control items as well as this change.)
/// <summary>
/// Extends the <code>System.Windows.Forms.WebBrowser</code> and adds the IsClosing event, as well as some JavaScript manipulation. It also adds some configuration that can be used to customize the operation of the control.
/// </summary>
public class ExtendedWebBrowser : WebBrowser
{
private const int WM_PARENTNOTIFY = 528;
private const int WM_DESTROY = 2;
/// <summary>
/// This event is called anytime the WebBrowser is set to destroy itself, including Javascript window.close() calls.
/// </summary>
public event EventHandler<EventArgs> IsClosing;
/// <summary>
/// Overrides the default <see cref="WebBrowser.WndProc(ref Message)"/> method.
/// </summary>
/// <param name="m">The <code>System.Windows.Forms.Message</code> being sent to the control.</param>
protected override void WndProc(ref Message m)
{
if (m.Msg == WM_PARENTNOTIFY)
{
if (!DesignMode && m.WParam.ToInt32() == WM_DESTROY)
{
IsClosing(this, new EventArgs());
}
DefWndProc(ref m);
}
else
{
base.WndProc(ref m);
}
}
/// <summary>
/// Injects some JavaScript to the <see cref="ExtendedWebBrowser"/>.
/// </summary>
/// <param name="javaScript">The code to inject.</param>
/// <param name="name">The name of the script.</param>
public HtmlElement InjectScript(string javaScript, string name)
{
var head = Document.GetElementsByTagName("head")[0];
var scriptElement = Document.CreateElement("script");
scriptElement.Name = name;
scriptElement.SetAttribute("text", javaScript);
head.AppendChild(scriptElement);
return scriptElement;
}
/// <summary>
/// Executes a JavaScript method in the <see cref="ExtendedWebBrowser"/>.
/// </summary>
/// <param name="scriptName">The name of the method to invoke.</param>
/// <param name="args">The arguments to pass to the method.</param>
public void ExecuteScript(string scriptName, params object[] args)
{
Document.InvokeScript(scriptName, args);
}
/// <summary>
/// Executes arbitrary JavaScript code.
/// </summary>
/// <param name="script">The code to invoke.</param>
/// <remarks>
/// This creates an element with the name <code>arbitrary-script</code> with a javascript method called <code>arbitraryScript</code>. If a method with this name is present in the document, this method may not have the desired effect. If an element with the aforementioned name is present, it will be altered.
/// </remarks>
public void ExecuteArbitraryJavaScript(string script)
{
var arbitraryScript = Document.GetElementById("arbitrary-script");
if (arbitraryScript == null)
{
arbitraryScript = InjectScript("function arbitraryScript() { " + script + " }", "arbitrary-script");
}
else
{
arbitraryScript.SetAttribute("text", "function arbitraryScript() { " + script + " }");
}
ExecuteScript("arbitraryScript");
arbitraryScript.SetAttribute("text", "");
}
private void SetDWordKey(string baseKey, string name, uint value)
{
using (var key = Registry.CurrentUser.CreateSubKey(baseKey, RegistryKeyPermissionCheck.ReadWriteSubTree))
{
key.SetValue(name, value, RegistryValueKind.DWord);
}
}
/// <summary>
/// Initializes the <see cref="ExtendedWebBrowser"/> with the provided configuration.
/// </summary>
/// <param name="config">The <see cref="ExtendedWebBrowserConfiguration"/> to update the registry with.</param>
/// <remarks>
/// This method will update the registry values of all properties with the <see cref="FeatureControlAttribute"/> on them, of the specified key to the provided value in the configuration object.
///
/// See: http://msdn.microsoft.com/en-us/library/ee330720(v=vs.85).aspx for more information on Feature Controls.
/// </remarks>
public void Initialize(ExtendedWebBrowserConfiguration config)
{
var name = System.IO.Path.GetFileName(Process.GetCurrentProcess().MainModule.FileName);
if (name.ToLower() == "devenv.exe" || name.ToLower() == "xdesproc.exe")
{
return;
}
foreach (var property in config.GetType().GetProperties().Where(property => Attribute.IsDefined(property, typeof(FeatureControlAttribute))))
{
var attribute = (FeatureControlAttribute)property.GetCustomAttributes(typeof(FeatureControlAttribute), true)[0];
var rawValue = property.GetValue(config);
var cleanValue = 0u;
if (rawValue is bool)
{
cleanValue = (bool)rawValue ? 1u : 0u;
}
else
{
cleanValue = (uint)rawValue;
}
SetDWordKey(@"Software\Microsoft\Internet Explorer\Main\FeatureControl\" + attribute.Key, name, cleanValue);
}
}
}
The configuration class:
public class ExtendedWebBrowserConfiguration
{
private int _emulationVersion;
public int EmulationVersion
{
get { return _emulationVersion; }
set
{
if (value >= 7 && value <= 11)
{
_emulationVersion = value;
return;
}
throw new ArgumentException("The provided value is invalid. Valid versions are values from 7 through 11.");
}
}
/// <summary>
/// FEATURE_RESTRICT_ABOUT_PROTOCOL_IE7
/// </summary>
[FeatureControl("FEATURE_RESTRICT_ABOUT_PROTOCOL_IE7")]
public bool AboutProtocolRestriction { get; set; }
/// <summary>
/// FEATURE_SAFE_BINDTOOBJECT
/// </summary>
[FeatureControl("FEATURE_SAFE_BINDTOOBJECT")]
public bool ActiveXBindingSafetyChecks { get; set; }
/// <summary>
/// FEATURE_OBJECT_CACHING
/// </summary>
[FeatureControl("FEATURE_OBJECT_CACHING")]
public bool ActiveXObjectCaching { get; set; }
/// <summary>
/// FEATURE_RESTRICT_ACTIVEXINSTALL
/// </summary>
[FeatureControl("FEATURE_RESTRICT_ACTIVEXINSTALL")]
public bool ActiveXUpdateRestriction { get; set; }
/// <summary>
/// FEATURE_FORCE_ADDR_AND_STATUS
/// </summary>
[FeatureControl("FEATURE_FORCE_ADDR_AND_STATUS")]
public bool AddressAndStatusBarDisplay { get; set; }
/// <summary>
/// FEATURE_AJAX_CONNECTIONEVENTS
/// </summary>
[FeatureControl("FEATURE_AJAX_CONNECTIONEVENTS")]
public bool AjaxConnectionEvents { get; set; }
/// <summary>
/// FEATURE_SHOW_APP_PROTOCOL_WARN_DIALOG
/// </summary>
[FeatureControl("FEATURE_SHOW_APP_PROTOCOL_WARN_DIALOG")]
public bool ApplicationProtocolConfirmation { get; set; }
/// <summary>
/// FEATURE_BEHAVIORS
/// </summary>
[FeatureControl("FEATURE_BEHAVIORS")]
public bool BinaryBehaviorSecurity { get; set; }
/// <summary>
/// FEATURE_BROWSER_EMULATION
/// </summary>
[FeatureControl("FEATURE_BROWSER_EMULATION")]
public uint BrowserEmulation
{
get { return (uint)EmulationVersion * 1000; }
set { EmulationVersion = (int)value / 1000; }
}
/// <summary>
/// FEATURE_ENABLE_CLIPCHILDREN_OPTIMIZATION
/// </summary>
[FeatureControl("FEATURE_ENABLE_CLIPCHILDREN_OPTIMIZATION")]
public bool ChildWindowClipping { get; set; }
/// <summary>
/// FEATURE_MANAGE_SCRIPT_CIRCULAR_REFS
/// </summary>
[FeatureControl("FEATURE_MANAGE_SCRIPT_CIRCULAR_REFS")]
public bool CircularReferencesInScriptManagement { get; set; }
/// <summary>
/// FEATURE_ENABLE_SCRIPT_PASTE_URLACTION_IF_PROMPT
/// </summary>
[FeatureControl("FEATURE_ENABLE_SCRIPT_PASTE_URLACTION_IF_PROMPT")]
public bool ClipboardScriptControl { get; set; }
/// <summary>
/// FEATURE_BLOCK_SETCAPTURE_XDOMAIN
/// </summary>
[FeatureControl("FEATURE_BLOCK_SETCAPTURE_XDOMAIN")]
public bool CrossDomainCaptureEvent { get; set; }
/// <summary>
/// FEATURE_CROSS_DOMAIN_REDIRECT_MITIGATION
/// </summary>
[FeatureControl("FEATURE_CROSS_DOMAIN_REDIRECT_MITIGATION")]
public bool CrossDomainRedirection { get; set; }
/// <summary>
/// FEATURE_DOWNLOAD_INITIATOR_HTTP_HEADER
/// </summary>
[FeatureControl("FEATURE_DOWNLOAD_INITIATOR_HTTP_HEADER")]
public bool DebuggingNetworkTrafficRequests { get; set; }
/// <summary>
/// FEATURE_DOMSTORAGE
/// </summary>
[FeatureControl("FEATURE_DOMSTORAGE")]
public bool DomWebStorageApiSupport { get; set; }
/// <summary>
/// FEATURE_CFSTR_INETURLW_DRAGDROP_FORMAT
/// </summary>
[FeatureControl("FEATURE_CFSTR_INETURLW_DRAGDROP_FORMAT")]
public bool DragAndDropUrlFormat { get; set; }
/// <summary>
/// FEATURE_FEEDS
/// </summary>
[FeatureControl("FEATURE_FEEDS")]
public bool Feeds { get; set; }
/// <summary>
/// FEATURE_RESTRICT_FILEDOWNLOAD
/// </summary>
[FeatureControl("FEATURE_RESTRICT_FILEDOWNLOAD")]
public bool FileDownloadRestrictions { get; set; }
/// <summary>
/// FEATURE_BLOCK_CROSS_PROTOCOL_FILE_NAVIGATION
/// </summary>
[FeatureControl("FEATURE_BLOCK_CROSS_PROTOCOL_FILE_NAVIGATION")]
public bool FileProtocolNavigation { get; set; }
/// <summary>
/// FEATURE_IE6_DEFAULT_FRAME_NAVIGATION_BEHAVIOR
/// </summary>
[FeatureControl("FEATURE_IE6_DEFAULT_FRAME_NAVIGATION_BEHAVIOR")]
public bool FrameContentModification { get; set; }
/// <summary>
/// FEATURE_VIEWLINKEDWEBOC_IS_UNSAFE
/// </summary>
[FeatureControl("FEATURE_VIEWLINKEDWEBOC_IS_UNSAFE")]
public bool FrameContentSecurity { get; set; }
/// <summary>
/// FEATURE_GPU_RENDERING
/// </summary>
[FeatureControl("FEATURE_GPU_RENDERING")]
public bool GpuRendering { get; set; }
/// <summary>
/// FEATURE_MAXCONNECTIONSPER1_0SERVER
/// </summary>
[FeatureControl("FEATURE_MAXCONNECTIONSPER1_0SERVER")]
public uint Http10ConnectionMaximum { get; set; }
/// <summary>
/// MAXCONNECTIONSPERSERVER
/// </summary>
[FeatureControl("MAXCONNECTIONSPERSERVER")]
public uint Http11ConnectionMaximum { get; set; }
/// <summary>
/// FEATURE_IFRAME_MAILTO_THRESHOLD
/// </summary>
[FeatureControl("FEATURE_IFRAME_MAILTO_THRESHOLD")]
public bool IFrameMailToThreshold { get; set; }
/// <summary>
/// FEATURE_MIME_TREAT_IMAGE_AS_AUTHORITATIVE
/// </summary>
[FeatureControl("FEATURE_MIME_TREAT_IMAGE_AS_AUTHORITATIVE")]
public bool ImageMimeTypeDetermination { get; set; }
/// <summary>
/// FEATURE_SECURITYBAND
/// </summary>
[FeatureControl("FEATURE_SECURITYBAND")]
public bool InformationBarHandling { get; set; }
/// <summary>
/// FEATURE_BLOCK_INPUT_PROMPTS
/// </summary>
[FeatureControl("FEATURE_BLOCK_INPUT_PROMPTS")]
public bool InputPromptBlocking { get; set; }
/// <summary>
/// FEATURE_IVIEWOBJECTDRAW_DMLT9_WITH_GDI
/// </summary>
[FeatureControl("FEATURE_IVIEWOBJECTDRAW_DMLT9_WITH_GDI")]
public bool IViewObjectLegacyDrawing { get; set; }
/// <summary>
/// FEATURE_NINPUT_LEGACYMODE
/// </summary>
[FeatureControl("FEATURE_NINPUT_LEGACYMODE")]
public bool LegacyInputModel { get; set; }
/// <summary>
/// FEATURE_DISABLE_LEGACY_COMPRESSION
/// </summary>
[FeatureControl("FEATURE_DISABLE_LEGACY_COMPRESSION")]
public bool LegacyCompressionSupport { get; set; }
/// <summary>
/// FEATURE_LOCALMACHINE_LOCKDOWN
/// </summary>
[FeatureControl("FEATURE_LOCALMACHINE_LOCKDOWN")]
public bool LocalMachineLockdown { get; set; }
/// <summary>
/// FEATURE_BLOCK_LMZ_IMG
/// </summary>
[FeatureControl("FEATURE_BLOCK_LMZ_IMG")]
public bool LocalImageBlocking { get; set; }
/// <summary>
/// FEATURE_BLOCK_LMZ_OBJECT
/// </summary>
[FeatureControl("FEATURE_BLOCK_LMZ_OBJECT")]
public bool LocalObjectBlocking { get; set; }
/// <summary>
/// FEATURE_BLOCK_LMZ_SCRIPT
/// </summary>
[FeatureControl("FEATURE_BLOCK_LMZ_SCRIPT")]
public bool LocalScriptBlocking { get; set; }
/// <summary>
/// FEATURE_MIME_SNIFFING
/// </summary>
[FeatureControl("FEATURE_MIME_SNIFFING")]
public bool MimeTypeDetermination { get; set; }
/// <summary>
/// FEATURE_MIME_HANDLING
/// </summary>
[FeatureControl("FEATURE_MIME_HANDLING")]
public bool MimeTypeHandling { get; set; }
/// <summary>
/// FEATURE_DISABLE_MK_PROTOCOL
/// </summary>
[FeatureControl("FEATURE_DISABLE_MK_PROTOCOL")]
public bool MKProtocolSupport { get; set; }
/// <summary>
/// FEATURE_ISOLATE_NAMED_WINDOWS
/// </summary>
[FeatureControl("FEATURE_ISOLATE_NAMED_WINDOWS")]
public bool NamedWindowIsolation { get; set; }
/// <summary>
/// FEATURE_DISABLE_NAVIGATION_SOUNDS
/// </summary>
[FeatureControl("FEATURE_DISABLE_NAVIGATION_SOUNDS")]
public bool NavigationSoundSupport { get; set; }
/// <summary>
/// FEATURE_PROTOCOL_LOCKDOWN
/// </summary>
[FeatureControl("FEATURE_PROTOCOL_LOCKDOWN")]
public bool ProtocolLockdown { get; set; }
/// <summary>
/// FEATURE_RESTRICT_ACTIVEXINSTALL
/// </summary>
[FeatureControl("FEATURE_RESTRICT_ACTIVEXINSTALL")]
public bool ResourceProtocolRestriction { get; set; }
/// <summary>
/// FEATURE_DOWNLOAD_PROMPT_META_CONTROL
/// </summary>
[FeatureControl("FEATURE_DOWNLOAD_PROMPT_META_CONTROL")]
public bool SaveDialogButtonHiding { get; set; }
/// <summary>
/// FEATURE_SCRIPTURL_MITIGATION
/// </summary>
[FeatureControl("FEATURE_SCRIPTURL_MITIGATION")]
public bool ScriptUrlMitigation { get; set; }
/// <summary>
/// FEATURE_WARN_ON_SEC_CERT_REV_FAILED
/// </summary>
[FeatureControl("FEATURE_WARN_ON_SEC_CERT_REV_FAILED")]
public bool SecurityCertificateRevocationFailure { get; set; }
/// <summary>
/// FEATURE_LOAD_SHDOCLC_RESOURCES
/// </summary>
[FeatureControl("FEATURE_LOAD_SHDOCLC_RESOURCES")]
public bool ShdoclcDllResourceLoading { get; set; }
/// <summary>
/// FEATURE_SPELLCHECKING
/// </summary>
[FeatureControl("FEATURE_SPELLCHECKING")]
public bool SpellcheckAndAutoCorrectSupport { get; set; }
/// <summary>
/// FEATURE_SSLUX
/// </summary>
[FeatureControl("FEATURE_SSLUX")]
public bool SslSecurityAlertDisplay { get; set; }
/// <summary>
/// FEATURE_STATUS_BAR_THROTTLING
/// </summary>
[FeatureControl("FEATURE_STATUS_BAR_THROTTLING")]
public bool StatusBarUpdateFrequency { get; set; }
/// <summary>
/// FEATURE_RESTRICT_CDL_CLSIDSNIFF
/// </summary>
[FeatureControl("FEATURE_RESTRICT_CDL_CLSIDSNIFF")]
public bool StructuredStorageDetection { get; set; }
/// <summary>
/// FEATURE_TABBED_BROWSING
/// </summary>
[FeatureControl("FEATURE_TABBED_BROWSING")]
public bool TabbedBrowsingShortcutsAndNotifications { get; set; }
/// <summary>
/// FEATURE_DISABLE_TELNET_PROTOCOL
/// </summary>
[FeatureControl("FEATURE_DISABLE_TELNET_PROTOCOL")]
public bool TelnetProtocolSupport { get; set; }
/// <summary>
/// FEATURE_UNC_SAVEDFILECHECK
/// </summary>
[FeatureControl("FEATURE_UNC_SAVEDFILECHECK")]
public bool UncFileSupportForMotW { get; set; }
/// <summary>
/// FEATURE_HTTP_USERNAME_PASSWORD_DISABLE
/// </summary>
[FeatureControl("FEATURE_HTTP_USERNAME_PASSWORD_DISABLE")]
public bool UsernamesAndPasswordsInUrls { get; set; }
/// <summary>
/// FEATURE_VALIDATE_NAVIGATE_URL
/// </summary>
[FeatureControl("FEATURE_VALIDATE_NAVIGATE_URL")]
public bool ValidateUrlNavigation { get; set; }
/// <summary>
/// FEATURE_SHIM_MSHELP_COMBINE
/// </summary>
[FeatureControl("FEATURE_SHIM_MSHELP_COMBINE")]
public bool VisualStudioLegacyHelpSupport { get; set; }
/// <summary>
/// FEATURE_WEBOC_DOCUMENT_ZOOM
/// </summary>
[FeatureControl("FEATURE_WEBOC_DOCUMENT_ZOOM")]
public bool WebBrowserControlDocumentZoom { get; set; }
/// <summary>
/// FEATURE_WEBOC_POPUPMANAGEMENT
/// </summary>
[FeatureControl("FEATURE_WEBOC_POPUPMANAGEMENT")]
public bool WebBrowserControlPopupManagement { get; set; }
/// <summary>
/// FEATURE_WEBOC_MOVESIZECHILD
/// </summary>
[FeatureControl("FEATURE_WEBOC_MOVESIZECHILD")]
public bool WebBrowserControlWindowControl { get; set; }
/// <summary>
/// FEATURE_ENABLE_WEB_CONTROL_VISUALS
/// </summary>
[FeatureControl("FEATURE_ENABLE_WEB_CONTROL_VISUALS")]
public bool WebControlVisuals { get; set; }
/// <summary>
/// FEATURE_ADDON_MANAGEMENT
/// </summary>
[FeatureControl("FEATURE_ADDON_MANAGEMENT")]
public bool WebOcAddonManagement { get; set; }
/// <summary>
/// FEATURE_WEBSOCKET
/// </summary>
[FeatureControl("FEATURE_WEBSOCKET")]
public bool WebSocket { get; set; }
/// <summary>
/// FEATURE_WEBSOCKET_AUTHPROMPT
/// </summary>
[FeatureControl("FEATURE_WEBSOCKET_AUTHPROMPT")]
public bool WebSocketAuthenticationPrompt { get; set; }
/// <summary>
/// FEATURE_WEBSOCKET_CLOSETIMEOUT
/// </summary>
[FeatureControl("FEATURE_WEBSOCKET_CLOSETIMEOUT")]
public uint WebSocketCloseTimeout { get; set; }
/// <summary>
/// FEATURE_WEBSOCKET_MAXCONNECTIONSPERSERVER
/// </summary>
[FeatureControl("FEATURE_WEBSOCKET_MAXCONNECTIONSPERSERVER")]
public uint WebSocketMaximumServerConnections { get; set; }
/// <summary>
/// FEATURE_WEBSOCKET_FOLLOWHTTPREDIRECT
/// </summary>
[FeatureControl("FEATURE_WEBSOCKET_FOLLOWHTTPREDIRECT")]
public bool WebSocketFollowRedirects { get; set; }
/// <summary>
/// FEATURE_WINDOW_RESTRICTIONS
/// </summary>
[FeatureControl("FEATURE_WINDOW_RESTRICTIONS")]
public bool WindowRestrictions { get; set; }
/// <summary>
/// FEATURE_XDOMAINREQUEST
/// </summary>
[FeatureControl("FEATURE_XDOMAINREQUEST")]
public bool XDomainRequestObjectSupport { get; set; }
/// <summary>
/// FEATURE_XMLHTTP
/// </summary>
[FeatureControl("FEATURE_XMLHTTP")]
public bool XmlHttpRequestObjectSupport { get; set; }
/// <summary>
/// FEATURE_ZONE_ELEVATION
/// </summary>
[FeatureControl("FEATURE_ZONE_ELEVATION")]
public bool ZoneElevation { get; set; }
/// <summary>
/// FEATURE_RESTRICTED_ZONE_WHEN_FILE_NOT_FOUND
/// </summary>
[FeatureControl("FEATURE_RESTRICTED_ZONE_WHEN_FILE_NOT_FOUND")]
public bool ZoneHandlingForMissingFiles { get; set; }
/// <summary>
/// FEATURE_READ_ZONE_STRINGS_FROM_REGISTRY
/// </summary>
[FeatureControl("FEATURE_READ_ZONE_STRINGS_FROM_REGISTRY")]
public bool ZoneStringLoading { get; set; }
public static readonly ExtendedWebBrowserConfiguration WebBrowserControlDefault = new ExtendedWebBrowserConfiguration
{
AboutProtocolRestriction = false,
ActiveXBindingSafetyChecks = true,
ActiveXObjectCaching = true,
ActiveXUpdateRestriction = false,
AddressAndStatusBarDisplay = false,
AjaxConnectionEvents = false,
ApplicationProtocolConfirmation = false,
BinaryBehaviorSecurity = true,
BrowserEmulation = 7000u,
ChildWindowClipping = true,
CircularReferencesInScriptManagement = true,
ClipboardScriptControl = true,
CrossDomainCaptureEvent = true,
CrossDomainRedirection = true,
DebuggingNetworkTrafficRequests = false,
DomWebStorageApiSupport = true,
DragAndDropUrlFormat = true,
Feeds = false,
FileDownloadRestrictions = false,
FileProtocolNavigation = false,
FrameContentModification = false,
FrameContentSecurity = false,
GpuRendering = false,
Http10ConnectionMaximum = 6,
Http11ConnectionMaximum = 6,
IFrameMailToThreshold = false,
ImageMimeTypeDetermination = true,
InformationBarHandling = false,
InputPromptBlocking = false,
IViewObjectLegacyDrawing = true,
LegacyInputModel = true,
LegacyCompressionSupport = true,
LocalMachineLockdown = false,
LocalImageBlocking = false,
LocalObjectBlocking = false,
LocalScriptBlocking = false,
MimeTypeDetermination = true,
MimeTypeHandling = false,
MKProtocolSupport = true,
NamedWindowIsolation = true,
NavigationSoundSupport = false,
ProtocolLockdown = false,
ResourceProtocolRestriction = false,
SaveDialogButtonHiding = true,
ScriptUrlMitigation = false,
SecurityCertificateRevocationFailure = false,
ShdoclcDllResourceLoading = false,
SpellcheckAndAutoCorrectSupport = false,
SslSecurityAlertDisplay = false,
StatusBarUpdateFrequency = false,
StructuredStorageDetection = false,
TabbedBrowsingShortcutsAndNotifications = false,
TelnetProtocolSupport = false,
UncFileSupportForMotW = false,
UsernamesAndPasswordsInUrls = false,
ValidateUrlNavigation = false,
VisualStudioLegacyHelpSupport = true,
WebBrowserControlDocumentZoom = false,
WebBrowserControlPopupManagement = true,
WebBrowserControlWindowControl = false,
WebControlVisuals = false,
WebOcAddonManagement = false,
WebSocket = true,
WebSocketAuthenticationPrompt = false,
WebSocketCloseTimeout = 15000,
WebSocketMaximumServerConnections = 6,
WebSocketFollowRedirects = false,
WindowRestrictions = true,
XDomainRequestObjectSupport = true,
XmlHttpRequestObjectSupport = true,
ZoneElevation = true,
ZoneHandlingForMissingFiles = false,
ZoneStringLoading = false,
};
public static readonly ExtendedWebBrowserConfiguration InternetExplorerDefault = new ExtendedWebBrowserConfiguration
{
AboutProtocolRestriction = true,
ActiveXBindingSafetyChecks = true,
ActiveXObjectCaching = true,
ActiveXUpdateRestriction = false,
AddressAndStatusBarDisplay = true,
AjaxConnectionEvents = true,
ApplicationProtocolConfirmation = true,
BinaryBehaviorSecurity = true,
BrowserEmulation = 11000u,
ChildWindowClipping = true,
CircularReferencesInScriptManagement = true,
ClipboardScriptControl = false,
CrossDomainCaptureEvent = true,
CrossDomainRedirection = true,
DebuggingNetworkTrafficRequests = false,
DomWebStorageApiSupport = true,
DragAndDropUrlFormat = true,
Feeds = true,
FileDownloadRestrictions = false,
FileProtocolNavigation = true,
FrameContentModification = false,
FrameContentSecurity = true,
GpuRendering = true,
Http10ConnectionMaximum = 6,
Http11ConnectionMaximum = 6,
IFrameMailToThreshold = true,
ImageMimeTypeDetermination = true,
InformationBarHandling = true,
InputPromptBlocking = true,
IViewObjectLegacyDrawing = true,
LegacyInputModel = false,
LegacyCompressionSupport = true,
LocalMachineLockdown = true,
LocalImageBlocking = true,
LocalObjectBlocking = true,
LocalScriptBlocking = true,
MimeTypeDetermination = true,
MimeTypeHandling = true,
MKProtocolSupport = true,
NamedWindowIsolation = true,
NavigationSoundSupport = false,
ProtocolLockdown = false,
ResourceProtocolRestriction = true,
SaveDialogButtonHiding = true,
ScriptUrlMitigation = true,
SecurityCertificateRevocationFailure = false,
ShdoclcDllResourceLoading = false,
SpellcheckAndAutoCorrectSupport = false,
SslSecurityAlertDisplay = false,
StatusBarUpdateFrequency = true,
StructuredStorageDetection = false,
TabbedBrowsingShortcutsAndNotifications = true,
TelnetProtocolSupport = true,
UncFileSupportForMotW = true,
UsernamesAndPasswordsInUrls = true,
ValidateUrlNavigation = true,
VisualStudioLegacyHelpSupport = false,
WebBrowserControlDocumentZoom = true,
WebBrowserControlPopupManagement = true,
WebBrowserControlWindowControl = false,
WebControlVisuals = false,
WebOcAddonManagement = false,
WebSocket = true,
WebSocketAuthenticationPrompt = false,
WebSocketCloseTimeout = 15000,
WebSocketMaximumServerConnections = 6,
WebSocketFollowRedirects = false,
WindowRestrictions = true,
XDomainRequestObjectSupport = true,
XmlHttpRequestObjectSupport = true,
ZoneElevation = true,
ZoneHandlingForMissingFiles = false,
ZoneStringLoading = false,
};
}
And the attribute:
[AttributeUsage(AttributeTargets.Property)]
public class FeatureControlAttribute : Attribute
{
public string Key { get; set; }
public FeatureControlAttribute(string key)
{
Key = key;
}
}
Key
property of theFeatureControlAttribute
class. \$\endgroup\$