PC Review


Reply
Thread Tools Rate Thread

Advanced webbrowser control help needed

 
 
Jim Hubbard
Guest
Posts: n/a
 
      27th Nov 2004
I want to implement the same type of activeX restrictions in my browser
application that the new SP2 for XP places in Internet Explorer.

I have found 2 web pages dealing with this functionality
(http://msdn.microsoft.com/library/de...EATURELIST.asp
and
http://msdn.microsoft.com/library/de...tomization.asp)
but I am at a loss as to how to implement this functionality in VB.Net or
C#.

I tried adding urlmon.dll to my VB.Net project as a reference to use the
CoInternetSetFeatureEnabled functionality (see
http://msdn.microsoft.com/library/de...ureenabled.asp),
but Visual Studio will not allow it. I get, in part, "This is not a valid
assembly or COM component." when I try and add it to my project.

Any help in implementing this type of functionality would be greatly
appreciated.

VB.Net is the language I am most familiar with, but C# examples would also
be helpful. I will re-write the app in C# if needed.



 
Reply With Quote
 
 
 
 
Charles Law
Guest
Posts: n/a
 
      28th Nov 2004
Hi Jim

Try the following

<code>
Public Enum INTERNETFEATURELIST
FEATURE_OBJECT_CACHING = 0
FEATURE_ZONE_ELEVATION = 1
FEATURE_MIME_HANDLING = 2
FEATURE_MIME_SNIFFING = 3
FEATURE_WINDOW_RESTRICTIONS = 4
FEATURE_WEBOC_POPUPMANAGEMENT = 5
FEATURE_BEHAVIORS = 6
FEATURE_DISABLE_MK_PROTOCOL = 7
FEATURE_LOCALMACHINE_LOCKDOWN = 8
FEATURE_SECURITYBAND = 9
FEATURE_RESTRICT_ACTIVEXINSTALL = 10
FEATURE_VALIDATE_NAVIGATE_URL = 11
FEATURE_RESTRICT_FILEDOWNLOAD = 12
FEATURE_ADDON_MANAGEMENT = 13
FEATURE_PROTOCOL_LOCKDOWN = 14
FEATURE_HTTP_USERNAME_PASSWORD_DISABLE = 15
FEATURE_SAFE_BINDTOOBJECT = 16
FEATURE_UNC_SAVEDFILECHECK = 17
FEATURE_GET_URL_DOM_FILEPATH_UNENCODED = 18
FEATURE_ENTRY_COUNT = 19
End Enum

<DllImport("urlmon.DLL")> _
Public Shared Function CoInternetSetFeatureEnabled(ByVal featureEntry As
INTERNETFEATURELIST, ByVal dwFlags As Integer, ByVal fEnable As Boolean) As
Integer
End Function

<DllImport("urlmon.DLL")> _
Public Shared Function CoInternetIsFeatureEnabled(ByVal featureEntry As
INTERNETFEATURELIST, ByVal dwFlags As Integer) As Integer
End Function

Private Sub SetFeatureEnabled()

Dim lr As Integer = 0

Dim featureToEnable As INTERNETFEATURELIST =
INTERNETFEATURELIST.FEATURE_WEBOC_POPUPMANAGEMENT

If CoInternetSetFeatureEnabled(featureToEnable,
SET_FEATURE_ON_PROCESS, True) = 0 Then
' Check to make sure that the API worked as expected
If CoInternetIsFeatureEnabled(featureToEnable,
SET_FEATURE_ON_PROCESS) <> 0 Then
lr = 2
End If
Else
' The API returned an error while enabling pop-up management
lr = 1
End If

End Sub
</code>

Calling SetFeatureEnabled runs without error, although I haven't attempted
to check whether the browser then behaves as you expect. It does, however,
load the page that I subsequently navigate to.

HTH

Charles



"Jim Hubbard" <(E-Mail Removed)> wrote in message
news:Eh3qd.37929$(E-Mail Removed)...
>I want to implement the same type of activeX restrictions in my browser
> application that the new SP2 for XP places in Internet Explorer.
>
> I have found 2 web pages dealing with this functionality
> (http://msdn.microsoft.com/library/de...EATURELIST.asp
> and
> http://msdn.microsoft.com/library/de...tomization.asp)
> but I am at a loss as to how to implement this functionality in VB.Net or
> C#.
>
> I tried adding urlmon.dll to my VB.Net project as a reference to use the
> CoInternetSetFeatureEnabled functionality (see
> http://msdn.microsoft.com/library/de...ureenabled.asp),
> but Visual Studio will not allow it. I get, in part, "This is not a valid
> assembly or COM component." when I try and add it to my project.
>
> Any help in implementing this type of functionality would be greatly
> appreciated.
>
> VB.Net is the language I am most familiar with, but C# examples would also
> be helpful. I will re-write the app in C# if needed.
>
>
>



 
Reply With Quote
 
Jim Hubbard
Guest
Posts: n/a
 
      28th Nov 2004
Thanks for the help.

"Charles Law" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi Jim
>
> Try the following
>
> <code>
> Public Enum INTERNETFEATURELIST
> FEATURE_OBJECT_CACHING = 0
> FEATURE_ZONE_ELEVATION = 1
> FEATURE_MIME_HANDLING = 2
> FEATURE_MIME_SNIFFING = 3
> FEATURE_WINDOW_RESTRICTIONS = 4
> FEATURE_WEBOC_POPUPMANAGEMENT = 5
> FEATURE_BEHAVIORS = 6
> FEATURE_DISABLE_MK_PROTOCOL = 7
> FEATURE_LOCALMACHINE_LOCKDOWN = 8
> FEATURE_SECURITYBAND = 9
> FEATURE_RESTRICT_ACTIVEXINSTALL = 10
> FEATURE_VALIDATE_NAVIGATE_URL = 11
> FEATURE_RESTRICT_FILEDOWNLOAD = 12
> FEATURE_ADDON_MANAGEMENT = 13
> FEATURE_PROTOCOL_LOCKDOWN = 14
> FEATURE_HTTP_USERNAME_PASSWORD_DISABLE = 15
> FEATURE_SAFE_BINDTOOBJECT = 16
> FEATURE_UNC_SAVEDFILECHECK = 17
> FEATURE_GET_URL_DOM_FILEPATH_UNENCODED = 18
> FEATURE_ENTRY_COUNT = 19
> End Enum
>
> <DllImport("urlmon.DLL")> _
> Public Shared Function CoInternetSetFeatureEnabled(ByVal featureEntry
> As INTERNETFEATURELIST, ByVal dwFlags As Integer, ByVal fEnable As
> Boolean) As Integer
> End Function
>
> <DllImport("urlmon.DLL")> _
> Public Shared Function CoInternetIsFeatureEnabled(ByVal featureEntry As
> INTERNETFEATURELIST, ByVal dwFlags As Integer) As Integer
> End Function
>
> Private Sub SetFeatureEnabled()
>
> Dim lr As Integer = 0
>
> Dim featureToEnable As INTERNETFEATURELIST =
> INTERNETFEATURELIST.FEATURE_WEBOC_POPUPMANAGEMENT
>
> If CoInternetSetFeatureEnabled(featureToEnable,
> SET_FEATURE_ON_PROCESS, True) = 0 Then
> ' Check to make sure that the API worked as expected
> If CoInternetIsFeatureEnabled(featureToEnable,
> SET_FEATURE_ON_PROCESS) <> 0 Then
> lr = 2
> End If
> Else
> ' The API returned an error while enabling pop-up management
> lr = 1
> End If
>
> End Sub
> </code>
>
> Calling SetFeatureEnabled runs without error, although I haven't attempted
> to check whether the browser then behaves as you expect. It does, however,
> load the page that I subsequently navigate to.
>
> HTH
>
> Charles
>
>
>
> "Jim Hubbard" <(E-Mail Removed)> wrote in message
> news:Eh3qd.37929$(E-Mail Removed)...
>>I want to implement the same type of activeX restrictions in my browser
>> application that the new SP2 for XP places in Internet Explorer.
>>
>> I have found 2 web pages dealing with this functionality
>> (http://msdn.microsoft.com/library/de...EATURELIST.asp
>> and
>> http://msdn.microsoft.com/library/de...tomization.asp)
>> but I am at a loss as to how to implement this functionality in VB.Net or
>> C#.
>>
>> I tried adding urlmon.dll to my VB.Net project as a reference to use the
>> CoInternetSetFeatureEnabled functionality (see
>> http://msdn.microsoft.com/library/de...ureenabled.asp),
>> but Visual Studio will not allow it. I get, in part, "This is not a
>> valid
>> assembly or COM component." when I try and add it to my project.
>>
>> Any help in implementing this type of functionality would be greatly
>> appreciated.
>>
>> VB.Net is the language I am most familiar with, but C# examples would
>> also
>> be helpful. I will re-write the app in C# if needed.
>>
>>
>>

>
>



 
Reply With Quote
 
Jim Hubbard
Guest
Posts: n/a
 
      29th Nov 2004
Found that the Microsoft security model interferes with handling security
myself without allowing the granular control that I need for each URL.

I found a way that should work and am coding my own control (that uses the
webbrowser control also) to allow total control over the objects displayed
in the webbrowser control (whether they are vbscripts, java applets, activeX
controls, images or whatever).

Thanks again for the help.

"Jim Hubbard" <(E-Mail Removed)> wrote in message
news:BKnqd.134432$(E-Mail Removed)...
> Thanks for the help.
>
> "Charles Law" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> Hi Jim
>>
>> Try the following
>>
>> <code>
>> Public Enum INTERNETFEATURELIST
>> FEATURE_OBJECT_CACHING = 0
>> FEATURE_ZONE_ELEVATION = 1
>> FEATURE_MIME_HANDLING = 2
>> FEATURE_MIME_SNIFFING = 3
>> FEATURE_WINDOW_RESTRICTIONS = 4
>> FEATURE_WEBOC_POPUPMANAGEMENT = 5
>> FEATURE_BEHAVIORS = 6
>> FEATURE_DISABLE_MK_PROTOCOL = 7
>> FEATURE_LOCALMACHINE_LOCKDOWN = 8
>> FEATURE_SECURITYBAND = 9
>> FEATURE_RESTRICT_ACTIVEXINSTALL = 10
>> FEATURE_VALIDATE_NAVIGATE_URL = 11
>> FEATURE_RESTRICT_FILEDOWNLOAD = 12
>> FEATURE_ADDON_MANAGEMENT = 13
>> FEATURE_PROTOCOL_LOCKDOWN = 14
>> FEATURE_HTTP_USERNAME_PASSWORD_DISABLE = 15
>> FEATURE_SAFE_BINDTOOBJECT = 16
>> FEATURE_UNC_SAVEDFILECHECK = 17
>> FEATURE_GET_URL_DOM_FILEPATH_UNENCODED = 18
>> FEATURE_ENTRY_COUNT = 19
>> End Enum
>>
>> <DllImport("urlmon.DLL")> _
>> Public Shared Function CoInternetSetFeatureEnabled(ByVal featureEntry
>> As INTERNETFEATURELIST, ByVal dwFlags As Integer, ByVal fEnable As
>> Boolean) As Integer
>> End Function
>>
>> <DllImport("urlmon.DLL")> _
>> Public Shared Function CoInternetIsFeatureEnabled(ByVal featureEntry
>> As INTERNETFEATURELIST, ByVal dwFlags As Integer) As Integer
>> End Function
>>
>> Private Sub SetFeatureEnabled()
>>
>> Dim lr As Integer = 0
>>
>> Dim featureToEnable As INTERNETFEATURELIST =
>> INTERNETFEATURELIST.FEATURE_WEBOC_POPUPMANAGEMENT
>>
>> If CoInternetSetFeatureEnabled(featureToEnable,
>> SET_FEATURE_ON_PROCESS, True) = 0 Then
>> ' Check to make sure that the API worked as expected
>> If CoInternetIsFeatureEnabled(featureToEnable,
>> SET_FEATURE_ON_PROCESS) <> 0 Then
>> lr = 2
>> End If
>> Else
>> ' The API returned an error while enabling pop-up management
>> lr = 1
>> End If
>>
>> End Sub
>> </code>
>>
>> Calling SetFeatureEnabled runs without error, although I haven't
>> attempted to check whether the browser then behaves as you expect. It
>> does, however, load the page that I subsequently navigate to.
>>
>> HTH
>>
>> Charles
>>
>>
>>
>> "Jim Hubbard" <(E-Mail Removed)> wrote in message
>> news:Eh3qd.37929$(E-Mail Removed)...
>>>I want to implement the same type of activeX restrictions in my browser
>>> application that the new SP2 for XP places in Internet Explorer.
>>>
>>> I have found 2 web pages dealing with this functionality
>>> (http://msdn.microsoft.com/library/de...EATURELIST.asp
>>> and
>>> http://msdn.microsoft.com/library/de...tomization.asp)
>>> but I am at a loss as to how to implement this functionality in VB.Net
>>> or
>>> C#.
>>>
>>> I tried adding urlmon.dll to my VB.Net project as a reference to use
>>> the
>>> CoInternetSetFeatureEnabled functionality (see
>>> http://msdn.microsoft.com/library/de...ureenabled.asp),
>>> but Visual Studio will not allow it. I get, in part, "This is not a
>>> valid
>>> assembly or COM component." when I try and add it to my project.
>>>
>>> Any help in implementing this type of functionality would be greatly
>>> appreciated.
>>>
>>> VB.Net is the language I am most familiar with, but C# examples would
>>> also
>>> be helpful. I will re-write the app in C# if needed.
>>>
>>>
>>>

>>
>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help needed with InvokeScript functionality of WebBrowser control Deepesh Microsoft VB .NET 0 23rd May 2007 08:06 AM
Advanced Conditional Formatting Ideas Needed! (ok, maybe not that advanced...) shadestreet Microsoft Excel Misc 2 21st Jul 2006 03:04 PM
Advanced webbrowser control help needed Jim Hubbard Microsoft C# .NET 3 29th Nov 2004 03:58 PM
Advanced webbrowser control help needed Jim Hubbard Microsoft Dot NET 3 29th Nov 2004 03:58 PM
Advanced help with Webbrowser control needed... Jim Hubbard Microsoft Dot NET 1 29th Nov 2004 03:52 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:49 AM.