Strange permission issue with a UserControl

From: ejstembler (ejstembler_at_discussions.microsoft.com)
Date: 12/20/04

  • Next message: John Lee: "Re: Authorization Manager, ASP.NET, possible memory leak"
    Date: Mon, 20 Dec 2004 12:41:02 -0800
    
    

    I'm encountering a strange permission issue with a custom UserControl...

    The UserControl is part of a WinForms project (exe), however it exposes a
    public event which declared in another assembly (dll). Nothing out of the
    ordinary there. A winform (FormMain) in the exe project contains the custom
    UserControl on it, and implements the event. In the event, I call another
    method which calls a stored procedure and displays a MessageBox if it fails.
    If I call that method from any other method in the form (such as
    FormMain_Load) it works fine. If the method is called from the UserControl
    event it throws a SqlClientPermission error (which is never displayed) and
    then a UIPermission error when the MessageBox is attempted to be displayed.
    I'm assuming that the UserControl has less rights for some reason; but why?
    It's almost acting like it's treating it as though it's in another less
    trusted zone (such as Local Network, or Internet). Both the WinForm assembly
    (exe) and the referenced assembly (dll) are on the local computer. Even if I
    grant FullTrust to all of the assemblies in question, the .Net run-time still
    displays the security exception dialog.

    Any ideas?


  • Next message: John Lee: "Re: Authorization Manager, ASP.NET, possible memory leak"

    Relevant Pages

    • Using an updated or newer assembly?
      ... We have a C# Winform application that depends on three or four assemblies. ... The exe will not use the newly compiled dll. ...
      (microsoft.public.dotnet.security)
    • RE: Could not load file or assembly App_Web_tod59ga8 and similar
      ... > compiled assemblies of the UserControl or any dependencs are invisible ... > the same folder, if we use purely dynamic compilation, the usercontrol ...
      (microsoft.public.dotnet.framework.aspnet)
    • RE: Could not load file or assembly App_Web_tod59ga8 and similar
      ... it is likely caused by the dynamically compiled assemblies ... of the UserControl or any dependencs are invisible to it. ... An unhandled exception occurred during the ... |> PublicKeyToken=null' or one of its dependencies. ...
      (microsoft.public.dotnet.framework.aspnet)
    • Re: Debugging dll newb question
      ... Close all of your VB IDE copies, Open the standard EXE project file. ... but sets the file name for the DLL to itself. ... have to make a UserControl as an OCX to use it in an EXE. ... EXE project, just go to Project-->Add User Control, and start making your ...
      (microsoft.public.vb.general.discussion)
    • Re: Lose Design-Time Support for UserControl...
      ... rendered inside a single winform. ... cameraCaptureDialog object, I loose design-time support for the UserControl, ... Instead, the UserControl just renders it name in text, ...
      (microsoft.public.pocketpc.developer)