Using trusted assemblies from classic ASP

Ask a Question related to ASP.NET Security, Design and Development.

  1. #1

    Default Using trusted assemblies from classic ASP

    I have a .NET assembly which utilizes the System.Management classes to
    retrieve information about the computer. When run under ASP.NET, I can use
    this assembly with no problems. But now I'm trying to use with from within
    classic ASP. The assembly is strongly-named and I've registered it using
    "regasm /codebase" (I've also tried it in the GAC without the /codebase).
    But when I use the component in ASP thru COM interop on either Win 2K or Win
    2K3, I get the following exception when I try to execute my WMI query:

    System.Exception: Error reading MAC Address information: Access denied
    ---> System.Management.ManagementException: Access denied

    at
    System.Management.ManagementException.ThrowWithExt endedInfo(ManagementStatus
    errorCode)
    at System.Management.ManagementObjectSearcher.Get()

    I even tried going into the .NET security configuration console and granting
    FullTrust premissions based on the public key with which I signed my
    assembly. It seemed to have no effect (although I can't say definiteively I
    put the code group in the right place -- I stuck it directly under the
    All_Code node in the Machine policy group).

    I don't think this is identity-related because I have this ASP app running
    in the same App Pool as an ASP.NET app which has no problems running the WMI
    query. (I did try playing with the identity it ran with, even using a local
    admin, but to no avail). Somehow, when running through COM Interop, the
    component doesn't run with full trust -- does anyone know how I can
    configure the system to grant FullTrust to my assembly in this scenario?

    Thanks for your help -
    Ken


    Ken Kolda Guest

  2. Similar Questions and Discussions

    1. Are MS Assemblies in the GAC?
      I want to create strongly signed support assemblies so they can be shared by different ASP.NET web apps. This requires that they be installed into...
    2. Too many assemblies asp.net
      I have been developing several web applications in VB.NET. I have started to notice that when I run one of the applications, all the assemblies for...
    3. Locating assemblies in ASP.NET
      An ASPX page in a virtual directory does not find the compiled assembly containing the base class located in the application's bin directory...
    4. Strongly Named Assemblies - how do you create an installation that allows an assembly key to be trusted?
      We are publishing Winform controls in some of our WebForms. Our Assembly is strongly named, and we would like to create an installation that would...
    5. Locate assemblies in ASP.NET
      look into machine.config file "Hilton" <nomail@intellilogic.com> wrote in message news:02a701c34d05$7bba5490$a001280a@phx.gbl...
  3. #2

    Default Re: Using trusted assemblies from classic ASP

    This isn't a CAS issue, otherwise you would have got a SecurityException. You've got an indentity isssue somewhere, does the ASP.NET app use impersonation?

    Regards

    Richard Blewett - DevelopMentor
    [url]http://staff.develop.com/richardb/weblog[/url]

    nntp://news.microsoft.com/microsoft.public.dotnet.framework/<#czq72WrEHA.896@TK2MSFTNGP12.phx.gbl>

    I have a .NET assembly which utilizes the System.Management classes to
    retrieve information about the computer. When run under ASP.NET, I can use
    this assembly with no problems. But now I'm trying to use with from within
    classic ASP. The assembly is strongly-named and I've registered it using
    "regasm /codebase" (I've also tried it in the GAC without the /codebase).
    But when I use the component in ASP thru COM interop on either Win 2K or Win
    2K3, I get the following exception when I try to execute my WMI query:

    System.Exception: Error reading MAC Address information: Access denied
    ---> System.Management.ManagementException: Access denied

    at
    System.Management.ManagementException.ThrowWithExt endedInfo(ManagementStatus
    errorCode)
    at System.Management.ManagementObjectSearcher.Get()

    I even tried going into the .NET security configuration console and granting
    FullTrust premissions based on the public key with which I signed my
    assembly. It seemed to have no effect (although I can't say definiteively I
    put the code group in the right place -- I stuck it directly under the
    All_Code node in the Machine policy group).

    I don't think this is identity-related because I have this ASP app running
    in the same App Pool as an ASP.NET app which has no problems running the WMI
    query. (I did try playing with the identity it ran with, even using a local
    admin, but to no avail). Somehow, when running through COM Interop, the
    component doesn't run with full trust -- does anyone know how I can
    configure the system to grant FullTrust to my assembly in this scenario?

    Thanks for your help -
    Ken



    ---
    Incoming mail is certified Virus Free.
    Checked by AVG anti-virus system ([url]http://www.grisoft.com[/url]).
    Version: 6.0.771 / Virus Database: 518 - Release Date: 28/09/2004



    [microsoft.public.dotnet.framework]
    Richard Blewett [DevelopMentor] Guest

  4. #3

    Default Re: Using trusted assemblies from classic ASP

    Thanks for the quick response. I suspect you're right with identity being
    the issue although I didn't originally think this was the case.

    My web.config is the standard one generated by VS.NET, so there's no
    <identity> element in it. My machine.config is also the default, so it has
    <identity impersonate="false" userName="" password=""/>. I tried creating a
    new local user and placed him in pretty much every group (including
    Administrators, IIS_WPG, etc.) and setting the AppPool to run as this user.
    That seemed to have no effect (ASP.NET app worked, ASP didn't). None of
    built-in accounts for the AppPool identity work either.

    I also tried disabling Windows authentication in IIS on both the apps'
    virtual roots (so only anonymous access was being used). Again, no effect.

    Thanks again for the help -- if there's anything you can think of for me to
    try, let me know.

    Ken


    "Richard Blewett [DevelopMentor]" <richardb@develop.com> wrote in message
    news:uplTl%23WrEHA.2776@TK2MSFTNGP14.phx.gbl...
    > This isn't a CAS issue, otherwise you would have got a SecurityException.
    You've got an indentity isssue somewhere, does the ASP.NET app use
    impersonation?
    >
    > Regards
    >
    > Richard Blewett - DevelopMentor
    > [url]http://staff.develop.com/richardb/weblog[/url]
    >
    >
    nntp://news.microsoft.com/microsoft.public.dotnet.framework/<#czq72WrEHA.896@TK2MSFTNGP12.phx.gbl>
    >
    > I have a .NET assembly which utilizes the System.Management classes to
    > retrieve information about the computer. When run under ASP.NET, I can
    use
    > this assembly with no problems. But now I'm trying to use with from
    within
    > classic ASP. The assembly is strongly-named and I've registered it using
    > "regasm /codebase" (I've also tried it in the GAC without the /codebase).
    > But when I use the component in ASP thru COM interop on either Win 2K or
    Win
    > 2K3, I get the following exception when I try to execute my WMI query:
    >
    > System.Exception: Error reading MAC Address information: Access denied
    > ---> System.Management.ManagementException: Access denied
    >
    > at
    >
    System.Management.ManagementException.ThrowWithExt endedInfo(ManagementStatus
    > errorCode)
    > at System.Management.ManagementObjectSearcher.Get()
    >
    > I even tried going into the .NET security configuration console and
    granting
    > FullTrust premissions based on the public key with which I signed my
    > assembly. It seemed to have no effect (although I can't say definiteively
    I
    > put the code group in the right place -- I stuck it directly under the
    > All_Code node in the Machine policy group).
    >
    > I don't think this is identity-related because I have this ASP app
    running
    > in the same App Pool as an ASP.NET app which has no problems running the
    WMI
    > query. (I did try playing with the identity it ran with, even using a
    local
    > admin, but to no avail). Somehow, when running through COM Interop, the
    > component doesn't run with full trust -- does anyone know how I can
    > configure the system to grant FullTrust to my assembly in this scenario?
    >
    > Thanks for your help -
    > Ken
    >
    >
    >
    > ---
    > Incoming mail is certified Virus Free.
    > Checked by AVG anti-virus system ([url]http://www.grisoft.com[/url]).
    > Version: 6.0.771 / Virus Database: 518 - Release Date: 28/09/2004
    >
    >
    >
    > [microsoft.public.dotnet.framework]

    Ken Kolda Guest

  5. #4

    Default Re: Using trusted assemblies from classic ASP

    OK -- I figured it out. Should have tried this before... I changed the
    identity of the anonymous user for the virtual root to one with sufficient
    rights. The identity used for the AppPool didn't make a difference -- that's
    where I was thrown off. I guess ASP pages always impersonate the identity
    use by the IIS virtual root, whereas this is configurable in .NET.

    Thanks for the help -
    Ken


    "Ken Kolda" <ken.kolda@elliemae-nospamplease.com> wrote in message
    news:%23ERGSZXrEHA.1952@TK2MSFTNGP12.phx.gbl...
    > Thanks for the quick response. I suspect you're right with identity being
    > the issue although I didn't originally think this was the case.
    >
    > My web.config is the standard one generated by VS.NET, so there's no
    > <identity> element in it. My machine.config is also the default, so it has
    > <identity impersonate="false" userName="" password=""/>. I tried creating
    a
    > new local user and placed him in pretty much every group (including
    > Administrators, IIS_WPG, etc.) and setting the AppPool to run as this
    user.
    > That seemed to have no effect (ASP.NET app worked, ASP didn't). None of
    > built-in accounts for the AppPool identity work either.
    >
    > I also tried disabling Windows authentication in IIS on both the apps'
    > virtual roots (so only anonymous access was being used). Again, no effect.
    >
    > Thanks again for the help -- if there's anything you can think of for me
    to
    > try, let me know.
    >
    > Ken
    >
    >
    > "Richard Blewett [DevelopMentor]" <richardb@develop.com> wrote in message
    > news:uplTl%23WrEHA.2776@TK2MSFTNGP14.phx.gbl...
    > > This isn't a CAS issue, otherwise you would have got a
    SecurityException.
    > You've got an indentity isssue somewhere, does the ASP.NET app use
    > impersonation?
    > >
    > > Regards
    > >
    > > Richard Blewett - DevelopMentor
    > > [url]http://staff.develop.com/richardb/weblog[/url]
    > >
    > >
    >
    nntp://news.microsoft.com/microsoft.public.dotnet.framework/<#czq72WrEHA.896@TK2MSFTNGP12.phx.gbl>
    > >
    > > I have a .NET assembly which utilizes the System.Management classes to
    > > retrieve information about the computer. When run under ASP.NET, I can
    > use
    > > this assembly with no problems. But now I'm trying to use with from
    > within
    > > classic ASP. The assembly is strongly-named and I've registered it
    using
    > > "regasm /codebase" (I've also tried it in the GAC without the
    /codebase).
    > > But when I use the component in ASP thru COM interop on either Win 2K
    or
    > Win
    > > 2K3, I get the following exception when I try to execute my WMI query:
    > >
    > > System.Exception: Error reading MAC Address information: Access denied
    > > ---> System.Management.ManagementException: Access denied
    > >
    > > at
    > >
    >
    System.Management.ManagementException.ThrowWithExt endedInfo(ManagementStatus
    > > errorCode)
    > > at System.Management.ManagementObjectSearcher.Get()
    > >
    > > I even tried going into the .NET security configuration console and
    > granting
    > > FullTrust premissions based on the public key with which I signed my
    > > assembly. It seemed to have no effect (although I can't say
    definiteively
    > I
    > > put the code group in the right place -- I stuck it directly under the
    > > All_Code node in the Machine policy group).
    > >
    > > I don't think this is identity-related because I have this ASP app
    > running
    > > in the same App Pool as an ASP.NET app which has no problems running
    the
    > WMI
    > > query. (I did try playing with the identity it ran with, even using a
    > local
    > > admin, but to no avail). Somehow, when running through COM Interop, the
    > > component doesn't run with full trust -- does anyone know how I can
    > > configure the system to grant FullTrust to my assembly in this
    scenario?
    > >
    > > Thanks for your help -
    > > Ken
    > >
    > >
    > >
    > > ---
    > > Incoming mail is certified Virus Free.
    > > Checked by AVG anti-virus system ([url]http://www.grisoft.com[/url]).
    > > Version: 6.0.771 / Virus Database: 518 - Release Date: 28/09/2004
    > >
    > >
    > >
    > > [microsoft.public.dotnet.framework]
    >
    >

    Ken Kolda Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139