Web Config without App?

  • Thread starter Thread starter localhost
  • Start date Start date
L

localhost

Is a web.config read in any subdirectory of a web site,
or is web.config only read if it is itself in an
application main directory (eg site root or virtual
directory)?

Thanks.
 
localhost said:
Is a web.config read in any subdirectory of a web site,
or is web.config only read if it is itself in an
application main directory (eg site root or virtual
directory)?

http://msdn.microsoft.com/library/en-us/cpguide/html/cpconaspnetconfiguration.asp
Multiple configuration files, all named web.config, can appear in multiple
directories on an ASP.NET Web application server. Each web.config file
applies configuration settings to its own directory and all child directories
below it. Configuration files in child directories can supply configuration
information in addition to that inherited from parent directories, and the child
directory configuration settings can override or modify settings defined in
parent directories.

--

Thanks,
Carl Prothman
Microsoft ASP.NET MVP
http://www.able-consulting.com
 
I read that link, thanks.

The page at that link does not say if a web.config can be
placed anywhere, or if it is only used by ASP.NET if it
is located in an application root. I guess I should
assume that they can be placed anywhere.

us/cpguide/html/cpconaspnetconfiguration.asp

[snip]
 
localhost said:
I read that link, thanks.

The page at that link does not say if a web.config can be
placed anywhere, or if it is only used by ASP.NET if it
is located in an application root. I guess I should
assume that they can be placed anywhere.

The web.config file is typicallly placed underneath your web application's root direcectory.
You can also place seperate web.config files in sub-directories under your application's root
directory. I don't believe you can put the web.config file outside of your web application's
root directory.

--

Thanks,
Carl Prothman
Microsoft ASP.NET MVP
http://www.able-consulting.com
 
Hello,

Thanks for posting in the group.

ASP.NET applies configuration settings to resources in a hierarchical
manner. Web.config files supply configuration information to the
directories in which they are located and to all child directories. The
configuration settings for a Web resource are supplied by the configuration
file located in the same directory as the resource and by all configuration
files in all parent directories.

So I don't think we could put web.config anywhere in the hard disk. :)

Does that answer your question?

Best regards,
Yanhong Huang
Microsoft Community Support

Get Secure! ¨C www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Hi,

BTW, we could set
<appSettings file="relative file name">
</appSettings>
to specifies a relative path to an external file containing custom
application configuration settings. The specified file contains the same
kind of settings that are specified in the <add>, <remove>, and <clear>
elements and uses the same key/value pair format as those elements.
The path specified is relative to the main configuration file. For a
Windows Forms application, this would be the binary folder (such as
/bin/debug), not the location of the application configuration file. For
Web Forms applications, the path is relative to the application root, where
the web.config file is located.

For more information on it, please refer to MSDN link:
http://msdn.microsoft.com/library/en-us/cpgenref/html/gngrfAppSettingsElemen
t.asp?frame=true

Also, you could create a non-spam alias for use in the MSDN managed
newsgroups at
http://support.microsoft.com/default.aspx?scid=/servicedesks/msdn/nospam.asp
&SD=msdn. By doing so, we could send post notify email to you when there is
useful reply to your posts in the newsgroup.

Thanks very much.

Best regards,
Yanhong Huang
Microsoft Community Support

Get Secure! ¨C www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Back
Top