Windows Develop Bookmark and Share   
 index > ClickOnce and Setup & Deployment Projects > control in IE, fully trusted?, still throwing SecurityException
 

control in IE, fully trusted?, still throwing SecurityException

i've got a control in IE.
on IE's security settings i have the site as trusted.
i also have run the .NET Configuration Wizard,
to trust the assembly with full trust.
yet the control still throws SecurityExceptions ...
any ideas?
Thanks
casey
MigrationUser 1  Wednesday, May 21, 2003 9:44 AM
from the newsgroup, i was directed to this for debug info:
http://www.developersdex.com/vb/message.asp?r=3018807&p=2927

and the log returns a cryptic error:
Creating security manager

Microsoft.IE.Manager: Microsoft.IE.Manager: unique id lgth = 50
Microsoft.IE.SecureFactory: Create SecureFactory() with security information
Microsoft.IE.Manager: Created secure factory
Microsoft.IE.SecureFactory: Creating instance of the object in the correct domain
Microsoft.IE.SecureFactory: pUrl = http://www.mperfect.net/myControl/
Microsoft.IE.SecureFactory: id = 86474707A3777777E2D607562766563647E2E6564720000000
Microsoft.IE.SecureFactory: link = 
Microsoft.IE.SecureFactory: licenses = 
Microsoft.IE.Manager: Url = http://www.mperfect.net/myControl/
Microsoft.IE.Manager: UrlGetPartW returned 0
Microsoft.IE.Manager: CodeBase = http://www.mperfect.net
Microsoft.IE.Manager: Application = myControl
Microsoft.IE.Manager: Found a codebase
Microsoft.IE.Manager: UrlCanonicalize returned 0
Microsoft.IE.SecureFactory: URL codeBase: http://www.mperfect.net/
Microsoft.IE.SecureFactory: URL application: myControl
Microsoft.IE.SecureFactory: Locating domain for http://www.mperfect.net/
Microsoft.IE.IDKey: Created key
Microsoft.IE.Manager: The domain does not exist.
Microsoft.IE.IDKey: Created key
Microsoft.IE.Manager: The domain does not exist.
Microsoft.IE.SecureFactory: Need to create domain
Microsoft.IE.SecureFactory: Application base: http://www.mperfect.net/
Microsoft.IE.SecureFactory: Private Bin Path: bin
Microsoft.IE.IDKey: Created key
Microsoft.IE.SecureFactory: Trying to create instance of type http://www.mperfect.net/myControl/myControl.dll#HealthDynamicsSystems.WdcControl
Microsoft.IE.SecureFactory: System.Security.SecurityException: Request failed.

Server stack trace: 
   at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly)
   at System.Activator.CreateInstance(Type type, Boolean nonPublic)
   at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
   at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
   at System.Activator.CreateComInstanceFrom(String assemblyName, String typeName, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm)
   at System.AppDomain.CreateComInstanceFrom(String assemblyFile, String typeName, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm)
   at System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(MethodBase mb, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
   at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)

Exception rethrown at [0]: 
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at System.AppDomain.CreateComInstanceFrom(String assemblyFile, String typeName, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm)
   at Microsoft.IE.SecureFactory.CreateInstanceWithSecurity(Int32 dwFlag, Int32 dwZone, String pURL, String uniqueIdString, String link, String licenses)
Microsoft.IE.SecureFactory: LOG exception
Microsoft.IE.SecureFactory: Creating log entry ?FusionBindError!name=myControl.dll HealthDynamicsSystems.WdcControl
Microsoft.IE.SecureFactory: Logging to file C:\Documents and Settings\cchestc\Local Settings\Temporary Internet Files\Content.IE5\VAR0U0P2\CANE9979.HTM

any ideas on why CreateInstanceWithSecurity would fail?
(the URLs above have been changed, so they are not valid)

Thanks
casey
MigrationUser 1  Thursday, May 22, 2003 11:25 AM
this thread is also going on in the windowsforms.controls newsgroup of MS.

the current update is they had me remove strong naming (above),
which returns to my original problem, and brings up another problem.

1st) why would strong naming make my control work even less?
because without strong naming, it at least loads,
and then throws an exception while running.
using the config tool, the dll had unrestricted access,
i was also careful to clear the gac download cache and close all instances of IE

2nd) back to the original problem.
without strong naming, it loads, and then throws a SecurityException.
the config tool shows that this dll has unrestricted access as well.

System.Security.SecurityException:
Request for the permission of type System.Net.WebPermission, System, Version=1.0.5000.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089 failed.
 at System.Security.CodeAccessSecurityEngine.CheckHelper(grantedSet, deniedSet, demand, permToken)
 at System.Security.CodeAccessSecurityEngine.Check(permToken, demand, stackMark, checkFrames, unrestrictedOverride)
 at System.Security.CodeAccessSecurityEngine.Check(CodeAccessPermission cap, StackCrawlMark& stackMark)
 at System.Security.CodeAccessPermission.Demand()
 at System.Net.WebProxy.GetDefaultProxy()
 at MyNamespace.MyControl.GetWebServiceProxy()
 at MyNamespace.MyControl.DownloadImage()
 at MyNamespace.MyControl.MyControl_Load(Object sender, EventArgs e)

the exception is above,
all it was doing is getting the IE proxy to apply to a web service proxy,
to call back to a web service on the same domain it was served from.

so why would an unrestricted assembly throw a SecuriyException?

Thanks
casey
MigrationUser 1  Friday, May 23, 2003 10:55 AM

You can use google to search for other answers

Custom Search

More Threads

• Placing ClickOnce ShortCut in Startup Menu
• Customize error message displayed to user
• Can any one give some thoughts on Launching one ClickOnce Application from another ClickOnce Application using Application Reference with some Parameters
• deploy smart client that uses caching app block
• Doesn't check for updates on the first program start, only second
• Installer.Uninstall method firing before Installer.OnBeforeUninstall method.
• VB.NET 2003: Events ID 1004 & 1001 occurs randomly during building a deployment package
• Bug in Upgrading Window-Service Setup Project (w/ RemovePreviousVersion)
• support other languages
• ClickOnce install silently fails for terminal services user