how to reference assemblies from web.configs in subdirs?

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

  1. #1

    Default how to reference assemblies from web.configs in subdirs?

    Hello,

    I was wondering how I can reference assemblies from web.config files
    residing in subdirectories without having to create a new project for each
    web.config-containing subdirectory?

    I would like to use an HttpModule, but only for files in a particular
    directory, so I add a web.config file containing this:
    <?xml version="1.0" encoding="utf-8" ?>

    <configuration>


    <system.web>

    <httpModules>

    <add name="MessageAuthenticatorModule"
    type="Din.MessageAuthenticator,localhost"/>

    </httpModules>

    </system.web>

    </configuration>

    to the proper subdirectory. The problem is that the localhost.dll cannot be
    found for some reason, even though the web.config file should be part of the
    main web project. I really don't want to have to register anything in the
    GAC.

    Another question: if I have to resort to creating another web project with
    its root located at the subdirectory mentioned above, does the web.config
    file still inherit values from the main web project? If not, which I suspect
    is the case, then creating a separate project is not much of an alternative.

    Thank you,

    --
    Lucas Fletcher
    [email]lucas@dealersinnotions.com[/email]
    [url]http://dealersinnotions.com[/url]


    Lucas Fletcher Guest

  2. Similar Questions and Discussions

    1. Net:TFTPd questions - Want to upload configs via TFTP
      I am writing a script that will log into my network equipment and backup the configurations to a TFTP server. Since I don't want the security risk...
    2. 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...
    3. 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...
    4. Can't reference Assemblies in GAC?
      I've just created a simple class library, gave it a strong name using sn.exe, then copied it to c:\winnt\assembly directory. I then created an ASP...
    5. multiple net configs on laptop
      I'm running into divergent opinions and advice... Here's the background info and problem: Laptop with XP Pro configured to logon a Domain at one...
  3. #2

    Default Re: how to reference assemblies from web.configs in subdirs?

    Some additional information:

    The subdirectory was a web application, which explains why it was looking in
    its own bin directory.

    However: Now that I have removed the application at the subdir (so now it's
    just a plain virtual directory) the web.config file is not being read at
    all.

    I also tried using the <location> tag within the root's web.config, but
    still no go...


    "Lucas Fletcher" <lucas@dealersinnotions.com> wrote in message
    news:#iYNKRvVDHA.532@TK2MSFTNGP09.phx.gbl...
    > Hello,
    >
    > I was wondering how I can reference assemblies from web.config files
    > residing in subdirectories without having to create a new project for each
    > web.config-containing subdirectory?
    >
    > I would like to use an HttpModule, but only for files in a particular
    > directory, so I add a web.config file containing this:
    > <?xml version="1.0" encoding="utf-8" ?>
    >
    > <configuration>
    >
    >
    > <system.web>
    >
    > <httpModules>
    >
    > <add name="MessageAuthenticatorModule"
    > type="Din.MessageAuthenticator,localhost"/>
    >
    > </httpModules>
    >
    > </system.web>
    >
    > </configuration>
    >
    > to the proper subdirectory. The problem is that the localhost.dll cannot
    be
    > found for some reason, even though the web.config file should be part of
    the
    > main web project. I really don't want to have to register anything in the
    > GAC.
    >
    > Another question: if I have to resort to creating another web project with
    > its root located at the subdirectory mentioned above, does the web.config
    > file still inherit values from the main web project? If not, which I
    suspect
    > is the case, then creating a separate project is not much of an
    alternative.
    >
    > Thank you,
    >
    > --
    > Lucas Fletcher
    > [email]lucas@dealersinnotions.com[/email]
    > [url]http://dealersinnotions.com[/url]
    >
    >

    Lucas Fletcher Guest

  4. #3

    Default Re: how to reference assemblies from web.configs in subdirs?

    Lucas,

    I don't really have a pointer, but it looks like you're at a point where you
    could use anything...

    I once complained to Microsoft about the following. I had an ASP.NET web
    application installed in the root of a web site. Its web.config <add>ed an
    HttpModule, AModule. I then created a subapplication. That was a problem:

    1) The subapplication would not start, since it couldn't find AModule.
    2) The subapplication couldn't <remove> AModule, since it wasn't actually in
    the modules list

    I eventually had to put a copy of AModule in the bin directory of the
    subapplication so that it could <remove> it...

    I had similar fun with bad <add> entries not failing. The problem was that
    it hadn't gotten that far - it was failing on the <add> entry from the
    parent application before it got around to realizing that the <add> in the
    child application had invalid attributes.

    Good Luck with this. You may have to enter an incident with Microsoft to
    reach a resolution.
    --
    John Saunders
    Internet Engineer
    [email]john.saunders@surfcontrol.com[/email]

    "Lucas Fletcher" <lucas@dealersinnotions.com> wrote in message
    news:evUxZl0VDHA.2544@tk2msftngp13.phx.gbl...
    > If anyone cares:
    >
    > Further investigation yields that the subdir's web.config file is being
    read
    > to some degree. It does raise an error when containing bad xml. (Also I
    > notice the JIT recompiling when first viewing a page under it, after it
    has
    > been edited.) But if I change the add element's name or type attributes to
    > garbage,
    >
    > <add name="garbage" "garbage,garbage"/>
    >
    > no errors are raised (whereas if this were in the root web.config it
    would).
    >
    > This is very puzzling to me. It must be something I am doing wrong,
    because
    > I would imagine that many people have successfully done this before, since
    I
    > haven't found any other postings on it.
    >
    > Any pointers would be much appreciated...
    >
    > "Lucas Fletcher" <lucas@dealersinnotions.com> wrote in message
    > news:ePtW$wzVDHA.2328@TK2MSFTNGP12.phx.gbl...
    > > Some additional information:
    > >
    > > The subdirectory was a web application, which explains why it was
    looking
    > in
    > > its own bin directory.
    > >
    > > However: Now that I have removed the application at the subdir (so now
    > it's
    > > just a plain virtual directory) the web.config file is not being read at
    > > all.
    > >
    > > I also tried using the <location> tag within the root's web.config, but
    > > still no go...
    > >
    > >
    > > "Lucas Fletcher" <lucas@dealersinnotions.com> wrote in message
    > > news:#iYNKRvVDHA.532@TK2MSFTNGP09.phx.gbl...
    > > > Hello,
    > > >
    > > > I was wondering how I can reference assemblies from web.config files
    > > > residing in subdirectories without having to create a new project for
    > each
    > > > web.config-containing subdirectory?
    > > >
    > > > I would like to use an HttpModule, but only for files in a particular
    > > > directory, so I add a web.config file containing this:
    > > > <?xml version="1.0" encoding="utf-8" ?>
    > > >
    > > > <configuration>
    > > >
    > > >
    > > > <system.web>
    > > >
    > > > <httpModules>
    > > >
    > > > <add name="MessageAuthenticatorModule"
    > > > type="Din.MessageAuthenticator,localhost"/>
    > > >
    > > > </httpModules>
    > > >
    > > > </system.web>
    > > >
    > > > </configuration>
    > > >
    > > > to the proper subdirectory. The problem is that the localhost.dll
    cannot
    > > be
    > > > found for some reason, even though the web.config file should be part
    of
    > > the
    > > > main web project. I really don't want to have to register anything in
    > the
    > > > GAC.
    > > >
    > > > Another question: if I have to resort to creating another web project
    > with
    > > > its root located at the subdirectory mentioned above, does the
    > web.config
    > > > file still inherit values from the main web project? If not, which I
    > > suspect
    > > > is the case, then creating a separate project is not much of an
    > > alternative.
    > > >
    > > > Thank you,
    > > >
    > > > --
    > > > Lucas Fletcher
    > > > [email]lucas@dealersinnotions.com[/email]
    > > > [url]http://dealersinnotions.com[/url]
    > > >
    > > >
    > >
    > >
    >
    >

    John Saunders 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