Rank: Newbie Groups: Member
Joined: 3/22/2016 Posts: 3
|
A Proof Of Concept I am working on requires us to be able to view two browser windows with separate login sessions, in one screen. I am attempting to achieve this with a WPF Browser application that will be called from a link, implementing an AddIn Pipeline Model to enable separate AppDomains. The EO.WebBrowser is then set up in the AddIn library, and called in separate AppDomain to allow two different session Logins.
The process works only when I set the AddInSecurity level to FullTrust. When the AddIn is called from a WPF Browser application it has to be set at the same Security level as the main application, which is Intranet. I get the following error when doing so:
"A first chance exception of type 'System.Security.SecurityException' occurred in PresentationFramework.dll
Additional information: That assembly does not allow partially trusted callers."
Stack Trace: " at System.Security.CodeAccessSecurityEngine.ThrowSecurityException(RuntimeAssembly asm, PermissionSet granted, PermissionSet refused, RuntimeMethodHandleInternal rmh, SecurityAction action, Object demand, IPermission permThatFailed) at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) at System.Activator.CreateInstance(Type type, Boolean nonPublic) at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark) at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) at System.Activator.CreateInstance(Type type, Object[] args) at CreateInstance(Type type, Object[] arguments) at System.Xaml.Schema.SafeReflectionInvoker.CreateInstance(Type type, Object[] arguments) at System.Xaml.Schema.XamlTypeInvoker.CreateInstanceWithActivator(Type type, Object[] arguments) at System.Xaml.Schema.XamlTypeInvoker.CreateInstance(Object[] arguments) at MS.Internal.Xaml.Runtime.ClrObjectRuntime.CreateInstanceWithCtor(XamlType xamlType, Object[] args) at MS.Internal.Xaml.Runtime.ClrObjectRuntime.CreateInstance(XamlType xamlType, Object[] args) at System.Xaml.XamlObjectWriter.Logic_CreateAndAssignToParentStart(ObjectWriterContext ctx) at System.Xaml.XamlObjectWriter.WriteStartMember(XamlMember property) at System.Xaml.XamlWriter.WriteNode(XamlReader reader) at System.Windows.Markup.WpfXamlLoader.TransformNodes(XamlReader xamlReader, XamlObjectWriter xamlWriter, Boolean onlyLoadOneNode, Boolean skipJournaledProperties, Boolean shouldPassLineNumberInfo, IXamlLineInfo xamlLineInfo, IXamlLineInfoConsumer xamlLineInfoConsumer, XamlContextStack`1 stack, IStyleConnector styleConnector) at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri) at System.Windows.Markup.WpfXamlLoader.LoadBaml(XamlReader xamlReader, Boolean skipJournaledProperties, Object rootObject, XamlAccessLevel accessLevel, Uri baseUri) at System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream) at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator) at BrSigPipeline.AddIn.WebBrowserAddIn.InitializeComponent() at BrSigPipeline.AddIn.WebBrowserAddIn..ctor() "
It doesnt make a difference when I set the property [assembly: System.Security.AllowPartiallyTrustedCallers()] in the AddIn assembly file. I attempted the same with a WPF stand alone application, to eliminate Internet Browser settings as an issue and I see the same error.
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,229
|
Hi, We can add [assembly: AllowPartiallyTrustedCallers] to our DLL for you to test. That way you can find if this is the only issue. At runtime we do require full trust since we need to make a lot of system calls. So if those permission were not given then even if we had AllowPartiallyTrustedCallers set it would still fail. As a side note, we have built-in support for multiple sessions. So you do not have to use two different browser component to support multi-sessions. In order to support multi-session, you would just need to use two separate Engine objects. See here for more details: http://www.essentialobjects.com/doc/webbrowser/advanced/engine.aspxYou do not need to use a separate AppDomain for this. Thanks!
|
Rank: Newbie Groups: Member
Joined: 3/22/2016 Posts: 3
|
I always appreciate fast responses. Thank you! eo_support wrote:We can add [assembly: AllowPartiallyTrustedCallers] to our DLL for you to test. That way you can find if this is the only issue. Do you mean you can send a modified EO.WebBrowser component with the AllowPartiallyTrustedCallers setting added to test at my end? eo_support wrote: At runtime we do require full trust since we need to make a lot of system calls. So if those permission were not given then even if we had AllowPartiallyTrustedCallers set it would still fail.
In other words, is it safe to say that the EO.WebBrowser cannot run with Partial trust? If that's true, I am not sure if you providing the dll with the setting would lead me to a solution. It looks like I'll just have to talk to my admins about setting the main calling application to full trust mode. eo_support wrote:As a side note, we have built-in support for multiple sessions. So you do not have to use two different browser component to support multi-sessions. In order to support multi-session, you would just need to use two separate Engine objects. See here for more details: http://www.essentialobjects.com/doc/webbrowser/advanced/engine.aspxYou do not need to use a separate AppDomain for this. Ok, I took a look at your link, and I have sooooo many questions!! This has nothing to do with the Security issue I face - I could implement this built in ability to avoid creating separate AppDomains in my code. So I might branch my own post into two seperate topics 1. It wasnt clear from your link if I can create seperate engines only with separate threads in the WebBrowser to achieve separate sessions. 2. By default, do multiple browsers in a page use a single engine? Would it suffice to attach the newly defined engine to one of the Web Browsers? 3. What is the significance of Threadrunner property in a Webbrowser? Does it refer to the thread that WebBrowser is running in? 4. Can I embed the two WebBrowsers in the eo.WPF Splitview control?
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,229
|
Hi,
It is not exactly true that EO.WebBrowser cannot run with partial trust. It just needs the permission it needs, particularly it needs unmanaged code permission. And the default permission set for a partial trust application doesn't grant that permission. It is possible to modify your permission set and have this included in your "partial trust" level but I doubt whether your admin would be willing to do this since it would be much easier for him to just grant you full trust. However if you wish to try that, we can create test build with partial trust enabled on for you.
As to the multiple engine questions:
1. Engine has nothing to do with thread;
2. I am not sure what you meant by "multiple browsers in a page". By default, there is a single "Default" engine for your whole application (AppDomain) and that engine is used by every WebView;
3. You do not need to worry about the ThreadRunner. ThreadRunner does not have anything to do with engine directly. With our WebView, you can either create it in "on-screen" or "off-screen" mode. On screen mode is what most people use and it is visible on the screen, can interact with user input and it is driven by your application's UI thread. "Off-screen" mode is when some people want to create "headless" browser that mainly used for automation purposes (for example, you can load a page into an off-screen WebView and then capture a "screenshot" of the invisible WebView to produce an image of the web page). When you use a WebView in off-screen mode, you would usually need to use a ThreadRunner to drive it. This does not have anything to do with your case. For on-screen WebView, you simply set the WebView's Engine property to associate the engine to the WebView and that's it.
4. Yes.
Hope this clears up.
Thanks!
|
Rank: Newbie Groups: Member
Joined: 3/22/2016 Posts: 3
|
Thank you. I will be meeting with our security team this week and based on their inputs I can reach back to you if I need to test the control with AllowPartiallyTrustedCallers enabled.
In the meantime, I will try the two session browser functionality with separate engines and will let you know if I need more help there as well.
Appreciate all your help!
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,229
|
No problem. Please feel free to let us know if there is anything else.
Thanks!
|
Rank: Newbie Groups: Member
Joined: 4/18/2016 Posts: 2
|
Hi. I'm having this: That assembly does not allow partially trusted callers... issue, when trying to register the eo.pdf key at Global.asax file. The app user the EO.PDf and ASPXToPDF control. I really appreciate if you help me on this. Our weeb forms app is about to run under a third party web provider and I have very limitations on conifguring such IIS.
Thanks. Jamil.
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,229
|
Jamil wrote:Hi. I'm having this: That assembly does not allow partially trusted callers... issue, when trying to register the eo.pdf key at Global.asax file. The app user the EO.PDf and ASPXToPDF control. I really appreciate if you help me on this. Our weeb forms app is about to run under a third party web provider and I have very limitations on conifguring such IIS.
Thanks. Jamil.
Hi, You will not be able to use EO.Pdf in a partial trust enviornment. EO.Pdf makes numerous system API calls so it won't run without full trust. Thanks!
|
Rank: Newbie Groups: Member
Joined: 4/18/2016 Posts: 2
|
Well, I did not see such restriction just before I purchase a eo.pdf. It is posible to have my money back? Thanks.
|