IIS properties files

IIS properties files

am 10.10.2007 15:13:30 von albert.greinoecker

Hi NG,

maybe a too simple question for this newsgroup, but I could'nt manage to
solve this problem: how can I set up the directory lookup path where IIS
looks for custom configuration files or where should I place such files so
IIS can find them just the way java does with .properties-files
on the classpath?

thx in advance,
Albert

Re: IIS properties files

am 11.10.2007 04:32:11 von Ken Schaefer

Sorry - but what sort of "custom" configuration file are you looking for?
IIS itself can not use custom configuration files. Are you talking about a
configuration file for your application?

Cheers
Ken

"Albert Greinoecker" wrote in message
news:470ccffa$1@sia.uibk.ac.at...
> Hi NG,
>
> maybe a too simple question for this newsgroup, but I could'nt manage to
> solve this problem: how can I set up the directory lookup path where IIS
> looks for custom configuration files or where should I place such files so
> IIS can find them just the way java does with .properties-files
> on the classpath?
>
> thx in advance,
> Albert

Re: IIS properties files

am 11.10.2007 23:39:13 von albert.greinoecker

i just meant a simple text file holding configuration information like
database-url...or to generalize my question: how can I instruct the IIS to
look into a certain directory to find any kind of file needed within the
web application?

cheers,
Albert

Re: IIS properties files

am 12.10.2007 04:17:43 von Ken Schaefer

You are not making much sense.

Why would IIS need to look at another configuration file? IIS can not
connect to a database (for example).

Something like ASP.NET can connect to a database (using .NET libraries), and
ASP.NET uses web.config configuration files (which is where you would your
connection string).

Cheers
Ken

--
My IIS Blog: www.adOpenStatic.com/cs/blogs/ken


"Albert Greinoecker" wrote in message
news:470e9801$1@sia.uibk.ac.at...
>i just meant a simple text file holding configuration information like
> database-url...or to generalize my question: how can I instruct the IIS to
> look into a certain directory to find any kind of file needed within the
> web application?
>
> cheers,
> Albert

Re: IIS properties files

am 12.10.2007 13:37:01 von albert.greinoecker

sorry for imprecise formulation, of course I meant ASP.NET and I just want
to avoid web.config files.

cheers,
Albert

Re: IIS properties files

am 18.10.2007 12:12:28 von albert.greinoecker

ok, so just for clarification: there is no way to make a ASP.NET
application look after a file located relatively to the application's
current directory?

The problem is: in my ASP.NET application,
System.Envirmonment.CurrentDirectory points to c:\windows\System32, which
does not make any sense...can this setting be modified?

thx,
Albert

Re: IIS properties files

am 18.10.2007 14:19:39 von David Wang

On Oct 18, 3:12 am, Albert Greinoecker
wrote:
> ok, so just for clarification: there is no way to make a ASP.NET
> application look after a file located relatively to the application's
> current directory?
>
> The problem is: in my ASP.NET application,
> System.Envirmonment.CurrentDirectory points to c:\windows\System32, which
> does not make any sense...can this setting be modified?
>
> thx,
> Albert


You may want to ask questions in an ASP.Net dedicated forum for even
better responses, like at www.asp.net

I don't see why you want something like Java's .properties file
when .Net has similar and/or better solutions.

For example, ASP.Net web.config's AppSettings node allows generic name/
value pair storage/retrieval with a single line of .Net code. Plus,
web.config natively supports encrypted (including custom encryption
protocol) property values, handy for storing database query/username/
passwords.

Other platforms like Java, PHP, and ASP makes one build all the basic
building blocks like storage, session state, connectivity, etc for a
Web Application, so one gets all anxious at writing code to do such
things. Be very happy that ASP.Net 2.0 is far better. It verifiably
allows you to drag-and-drop your way to developing more functional web
applications with up to 80% less code than every other platform
including ASP.Net 1.1.

Now, why would "System.Environment.CurrentDirectory" change to map to
the current directory of an application? That would be something like
Application.Environment.CurrentDirectory , which doesn't exist for a
good reason. By definition, a process has a single "current
directory", which is what System.Environment.CurrentDirectory returns,
but multiple web applications can share a single process for
execution, so there is no way to have a single value for "current
directory" work for all web applications like the way you imagine.

How you find the "current directory" of an application is to use
Server.MapPath(), which allows you to determine the absolute
filesystem pathname that maps to a given URL virtual name. You can
also use Request.ServerVariable to retrieve APPL_PHYSICAL_PATH (which
is legacy, IIS-related), or you can retrieve the SCRIPT_NAME or URL
server variables, diff between the two to determine the URL root, and
Server.MapPath that value. You have complete flexibility to do
"current application directory" and everything in between.

Personally, I think ASP.Net 2.0 makes it incredibly easy to write
incredibly sophisticated web applications with very little effort.
Thus, if you are thinking of something too complex or if you had to
spend too long thinking about a solution, there's probably a better
solution/implementation that already exists within ASP.Net or
someone's shared component.


//David
http://w3-4u.blogspot.com
http://blogs.msdn.com/David.Wang
//