Results 1 to 4 of 4

Thread: Grant an app (DLL) permission in the security policy

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2000
    Location
    Birmingham, AL
    Posts
    1,276

    Question Grant an app (DLL) permission in the security policy

    I have an asp.net page that uses a DLL built in C# with an inherited windows control. When an event fires, a javascript function handles it. Everything works fine.

    Whenever I re-compile the DLL to the asp.net folder in wwwroot, view the asp.net page, and fire an event from the control, I get the Microsoft .NET Framework message "The application attempted to perform an operation not allowed by the security policy. The operation required the SecurityException. To grant this application the required permission please contact your system administrator, or use the Microsoft .NET security policy administration tool..."

    So I have to go to the Start Menu->Programs->Administrative Tools->Microsoft .NET Framework 1.1 Wizards->Trust an Assembly, browse for the DLL, set the trust level, and click OK. This is quite a hassle to do every time I re-compile the DLL. Could I write a script or .bat file to set this, set it and forget it, or just do away with it all together?

    It would really be a pain if users browsing my asp.net page had to do this everytime I re-compiled.

  2. #2
    Hyperactive Member
    Join Date
    Aug 2002
    Location
    Fort Collins, CO
    Posts
    366
    ...an asp.net page that uses a DLL built in C# with an inherited windows control...
    so are you trying to use a windows control in your asp.net app?

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2000
    Location
    Birmingham, AL
    Posts
    1,276
    Originally posted by pvb
    so are you trying to use a windows control in your asp.net app?
    That part already works. It's easy to show a Windows Forms control on a web page. The hard part comes in exposing the events of the control. Take a look at this about half way down the page:

    http://www.wintellect.com/resources/...aq_id=1&page=8

    The heading is "When hosting a Windows Forms control in a Web page, is it possible to connect the control's events to a handler implemented in client-side script?"

    They have a control that inherits from System.Windows.Forms.Trackbar compiled in a DLL and like they say:
    3) Grant the assembly containing the control (the control DLL) full trust on the client. You can use the Microsoft .NET Framework Wizards found in Control Panel/Administrative Tools to grant the assembly full trust.
    So every time you recompile your DLL you and your clients have to use that .NET wizard to grant the control full trust.

    I don't want me and my clients to have to open the wizard every time I recompile the DLL. I know it's a security issue and I'm sure that's why you have to do it manually. But I think I was reading somewhere how you can somehow make a trusted DLL.

  4. #4
    Hyperactive Member
    Join Date
    Aug 2002
    Location
    Fort Collins, CO
    Posts
    366
    Hmm...well, I don't really have an answer for ya, but I checked out a way cool article on code access security. The author makes a point of setting the assembly version number to a fixed number so it does not change with each compile(he mentions that otherwise the examples won't work). So maybe, it'd be worth trying(fixing the version number) and see if successive builds requires the .NET configuration settings to be reset.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width