In classic ASP I used to have a file called settings.asp included on every
page of my web, it consisted of a number of different settings unique to
this application, among them the database path etc.
I used to set some of the values contidional to which server executed the
script (see listing below). This way I could download the files, edit and
test run them locally, then put them back on the production server again
without having to worry about changing the paths each time.
My question now is: What would be the appropriate way of dealing with this
in .net?
/ Linda
-- partial content of settings.asp --
'--- Locally--------------------
If InStr(Request.ServerVariables("SERVER_NAME"), "mydevserver") Then
DBPATH = "DRIVER={Microsoft Access Driver (*.mdb)};
DBQ=D:\inetpub\wwwroot\customer\db\survey.mdb;"
BASE_URL = "http://mydevserver/customer/survey/"
FILE_FOLDER = "/files/"
'--- In production--------------
ElseIf InStr(Request.ServerVariables("SERVER_NAME"),
"customerserver.com") Then
DBPATH = "DRIVER={Microsoft Access Driver (*.mdb)};
DBQ=E:\webhotel\customers\customerserver.com\db\su rvey.mdb;"
BASE_URL = "http://www.customerserver.com/survey"
FILE_FOLDER = "/virtualfiledir/"
End If 19 1732
Hi Linda,
Use the app settings section in your web.config file:
<appSettings>
<add key="FileFolder" value="/foo" />
</appSettings>
You can read the settings with a little bit of code:
string fileFolder =
ConfigurationSettings.AppSettings["FileFolder"];
And you can pull environment specific settings into an external file
and reference the file from web.config:
<appSettings file="devsettings.config"/>
Where devsettings.config would contain an <appSettings> element. http://odetocode.com/Articles/345.aspx
HTH,
--
Scott http://www.OdeToCode.com/blogs/scott/
On Fri, 18 Mar 2005 16:25:25 +0100, "Linda"
<linda(at)ordinarystar.com> wrote: In classic ASP I used to have a file called settings.asp included on every page of my web, it consisted of a number of different settings unique to this application, among them the database path etc. I used to set some of the values contidional to which server executed the script (see listing below). This way I could download the files, edit and test run them locally, then put them back on the production server again without having to worry about changing the paths each time.
My question now is: What would be the appropriate way of dealing with this in .net?
/ Linda -- partial content of settings.asp --
'--- Locally-------------------- If InStr(Request.ServerVariables("SERVER_NAME"), "mydevserver") Then DBPATH = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=D:\inetpub\wwwroot\customer\db\survey.mdb;" BASE_URL = "http://mydevserver/customer/survey/" FILE_FOLDER = "/files/" '--- In production-------------- ElseIf InStr(Request.ServerVariables("SERVER_NAME"), "customerserver.com") Then DBPATH = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=E:\webhotel\customers\customerserver.com\db\s urvey.mdb;" BASE_URL = "http://www.customerserver.com/survey" FILE_FOLDER = "/virtualfiledir/" End If
In web.config you can use the <appSettings> section to store your custom
application settings (note that it's case sensitive):
<configuration>
<appSettings>
<add key="SomeKey" value="SomeValue" />
</appSettings>
</configuration>
Then in you app:
string val = System.Configuration.ConfigurationSettings.AppSett ings["SomeKey"];
// use val here....
-Brock
DevelopMentor http://staff.develop.com/ballen In classic ASP I used to have a file called settings.asp included on every page of my web, it consisted of a number of different settings unique to this application, among them the database path etc. I used to set some of the values contidional to which server executed the script (see listing below). This way I could download the files, edit and test run them locally, then put them back on the production server again without having to worry about changing the paths each time. My question now is: What would be the appropriate way of dealing with this in .net?
/ Linda
Set all the constants/properties in a class file which
you compile to an assembly and place in the /bin
directory of your application.
It's easy to call any constant/property from that .dll
Juan T. Llibre
ASP.NET MVP http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================
"Linda" <linda(at)ordinarystar.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl... In classic ASP I used to have a file called settings.asp included on every page of my web, it consisted of a number of different settings unique to this application, among them the database path etc.
I used to set some of the values contidional to which server executed the script (see listing below). This way I could download the files, edit and test run them locally, then put them back on the production server again without having to worry about changing the paths each time.
My question now is: What would be the appropriate way of dealing with this in .net?
/ Linda
-- partial content of settings.asp --
'--- Locally-------------------- If InStr(Request.ServerVariables("SERVER_NAME"), "mydevserver") Then DBPATH = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=D:\inetpub\wwwroot\customer\db\survey.mdb;" BASE_URL = "http://mydevserver/customer/survey/" FILE_FOLDER = "/files/" '--- In production-------------- ElseIf InStr(Request.ServerVariables("SERVER_NAME"), "customerserver.com") Then DBPATH = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=E:\webhotel\customers\customerserver.com\db\su rvey.mdb;" BASE_URL = "http://www.customerserver.com/survey" FILE_FOLDER = "/virtualfiledir/" End If
You guys are quick, thanks!!
I have looked briefly into the world of app settings before, and it solves
most of my problem, at least as long as I am the only developer involved.
But at some point there will be other developers, designers etc involved,
who have the bad habit of always downloading/uploading the entire app, of
course resulting in the exact same files in both (or all) locations.
Is there a way to solve that, other than educating my co-workers ;)
Is there a way to force the use of different app setting-files for different
locations. Or maybe it is posible to refer to an app setting file in a
directory outside of the actual application folder, where those co-workers
would never think to look?
/ Linda
"Scott Allen" <sc***@nospam.odetocode.com> wrote in message
news:4q********************************@4ax.com... Hi Linda,
Use the app settings section in your web.config file:
<appSettings> <add key="FileFolder" value="/foo" /> </appSettings>
You can read the settings with a little bit of code: string fileFolder = ConfigurationSettings.AppSettings["FileFolder"];
And you can pull environment specific settings into an external file and reference the file from web.config:
<appSettings file="devsettings.config"/>
Where devsettings.config would contain an <appSettings> element.
http://odetocode.com/Articles/345.aspx
HTH,
-- Scott http://www.OdeToCode.com/blogs/scott/
On Fri, 18 Mar 2005 16:25:25 +0100, "Linda" <linda(at)ordinarystar.com> wrote:
In classic ASP I used to have a file called settings.asp included on
everypage of my web, it consisted of a number of different settings unique to this application, among them the database path etc. I used to set some of the values contidional to which server executed the script (see listing below). This way I could download the files, edit and test run them locally, then put them back on the production server again without having to worry about changing the paths each time.
My question now is: What would be the appropriate way of dealing with
thisin .net?
/ Linda -- partial content of settings.asp --
'--- Locally-------------------- If InStr(Request.ServerVariables("SERVER_NAME"), "mydevserver") Then DBPATH = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=D:\inetpub\wwwroot\customer\db\survey.mdb;" BASE_URL = "http://mydevserver/customer/survey/" FILE_FOLDER = "/files/" '--- In production-------------- ElseIf InStr(Request.ServerVariables("SERVER_NAME"), "customerserver.com") Then DBPATH = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=E:\webhotel\customers\customerserver.com\db\s urvey.mdb;" BASE_URL = "http://www.customerserver.com/survey" FILE_FOLDER = "/virtualfiledir/" End If
I have a sample of building your own custom configuration sections which
uses the XmlSerializer. This is a very common technique in v1.x: http://staff.develop.com/ballen/samp...nfigSample.zip
-Brock
DevelopMentor http://staff.develop.com/ballen You guys are quick, thanks!!
I have looked briefly into the world of app settings before, and it solves most of my problem, at least as long as I am the only developer involved. But at some point there will be other developers, designers etc involved, who have the bad habit of always downloading/uploading the entire app, of course resulting in the exact same files in both (or all) locations. Is there a way to solve that, other than educating my co-workers ;) Is there a way to force the use of different app setting-files for different locations. Or maybe it is posible to refer to an app setting file in a directory outside of the actual application folder, where those co-workers would never think to look? / Linda
"Scott Allen" <sc***@nospam.odetocode.com> wrote in message news:4q********************************@4ax.com...
Hi Linda,
Use the app settings section in your web.config file:
<appSettings> <add key="FileFolder" value="/foo" /> </appSettings> You can read the settings with a little bit of code: string fileFolder = ConfigurationSettings.AppSettings["FileFolder"];
And you can pull environment specific settings into an external file and reference the file from web.config:
<appSettings file="devsettings.config"/>
Where devsettings.config would contain an <appSettings> element.
http://odetocode.com/Articles/345.aspx
HTH,
-- Scott http://www.OdeToCode.com/blogs/scott/ On Fri, 18 Mar 2005 16:25:25 +0100, "Linda" <linda(at)ordinarystar.com> wrote: In classic ASP I used to have a file called settings.asp included on every page of my web, it consisted of a number of different settings unique to this application, among them the database path etc. I used to set some of the values contidional to which server executed the script (see listing below). This way I could download the files, edit and test run them locally, then put them back on the production server again without having to worry about changing the paths each time. My question now is: What would be the appropriate way of dealing with this in .net?
/ Linda
-- partial content of settings.asp --
'--- Locally-------------------- If InStr(Request.ServerVariables("SERVER_NAME"), "mydevserver") Then DBPATH = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=D:\inetpub\wwwroot\customer\db\survey.mdb;" BASE_URL = "http://mydevserver/customer/survey/" FILE_FOLDER = "/files/" '--- In production-------------- ElseIf InStr(Request.ServerVariables("SERVER_NAME"), "customerserver.com") Then DBPATH = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=E:\webhotel\customers\customerserver.com\db\su rvey.mdb;" BASE_URL = "http://www.customerserver.com/survey" FILE_FOLDER = "/virtualfiledir/" End If
I agree with both schools of thought (web.config and class). There are uses
for both. For example, you can only store text data in the web.config. You
can store objects in a class. On the other hand, the web.config is read into
memory and remains memory-resident for the life of the app. A class can have
static methods that don't require instantiation, but often will require
instantiation. So, keep in mind what your options are, and use the
appropriate method.
--
HTH,
Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.
"Juan T. Llibre" <no***********@nowhere.com> wrote in message
news:OV**************@TK2MSFTNGP15.phx.gbl... Set all the constants/properties in a class file which you compile to an assembly and place in the /bin directory of your application.
It's easy to call any constant/property from that .dll Juan T. Llibre ASP.NET MVP http://asp.net.do/foros/ Foros de ASP.NET en Español Ven, y hablemos de ASP.NET... ======================
"Linda" <linda(at)ordinarystar.com> wrote in message news:%2****************@TK2MSFTNGP10.phx.gbl... In classic ASP I used to have a file called settings.asp included on every page of my web, it consisted of a number of different settings unique to this application, among them the database path etc.
I used to set some of the values contidional to which server executed the script (see listing below). This way I could download the files, edit and test run them locally, then put them back on the production server again without having to worry about changing the paths each time.
My question now is: What would be the appropriate way of dealing with this in .net?
/ Linda
-- partial content of settings.asp --
'--- Locally-------------------- If InStr(Request.ServerVariables("SERVER_NAME"), "mydevserver") Then DBPATH = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=D:\inetpub\wwwroot\customer\db\survey.mdb;" BASE_URL = "http://mydevserver/customer/survey/" FILE_FOLDER = "/files/" '--- In production-------------- ElseIf InStr(Request.ServerVariables("SERVER_NAME"), "customerserver.com") Then DBPATH = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=E:\webhotel\customers\customerserver.com\db\su rvey.mdb;" BASE_URL = "http://www.customerserver.com/survey" FILE_FOLDER = "/virtualfiledir/" End If
One way might be to encapsulate it into a Web User control. They are easy
to make though they don't have much visual representation at design time.
In your case that's no big deal.
Also, keep in mind that straight ASP techniques generally still work in
ASP.NET. They just might be the "old way" of doing things.
You could perhaps put a script block into each web form. They look
something like:
<script language=C# runat=server>
(code here)
</script>
You might try using the "src" attribute to refer to your asp include file.
I've never tried combining "runat=server" with a "src" attribute, but I
imagine it should work.
-jv
"Linda" <linda(at)ordinarystar.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl... In classic ASP I used to have a file called settings.asp included on every page of my web, it consisted of a number of different settings unique to this application, among them the database path etc. I used to set some of the values contidional to which server executed the script (see listing below). This way I could download the files, edit and test run them locally, then put them back on the production server again without having to worry about changing the paths each time.
My question now is: What would be the appropriate way of dealing with this in .net?
/ Linda
Actually, now that I reread your post, I would recommend putting the
settings in your WEB.CONFIG file and using the folllowing collection object
to retrieve them in each page:
System.Configuration.ConfigurationSettings.AppSett ings
Search for "Introduction to Dynamic Properties" in the online help for
details.
"Linda" <linda(at)ordinarystar.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl... In classic ASP I used to have a file called settings.asp included on every page of my web, it consisted of a number of different settings unique to this application, among them the database path etc. I used to set some of the values contidional to which server executed the script (see listing below). This way I could download the files, edit and test run them locally, then put them back on the production server again without having to worry about changing the paths each time.
My question now is: What would be the appropriate way of dealing with this in .net?
/ Linda -- partial content of settings.asp --
'--- Locally-------------------- If InStr(Request.ServerVariables("SERVER_NAME"), "mydevserver") Then DBPATH = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=D:\inetpub\wwwroot\customer\db\survey.mdb;" BASE_URL = "http://mydevserver/customer/survey/" FILE_FOLDER = "/files/" '--- In production-------------- ElseIf InStr(Request.ServerVariables("SERVER_NAME"), "customerserver.com") Then DBPATH = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=E:\webhotel\customers\customerserver.com\db\su rvey.mdb;" BASE_URL = "http://www.customerserver.com/survey" FILE_FOLDER = "/virtualfiledir/" End If
A couple of options occur off the top of my head:
a) configure your team's FTP software to ignore "web.config" files
(Dreamweaver does it with "cloaking", NAnt and other tools with
regular expressions of some sort)
b) if your deployments are to known servers with predictable and
stable URLs, you could hard code the settings into an assembly (dll)
with a static accessor that does some sort of switching on the current
URL.
b.1) depending on how complicated your configuration is, you may even
draft an Interface and then derive an actual configuration class for
each deployment.
then again, these 'b' options may result in deploying lots of extra
code with each setup, so a simpler solution, depending on your
toolset, would be 'a'. :-)
David.
Linda (at) wrote: My question now is: What would be the appropriate way of dealing with
this in .net?
I'm surprised that nobody here has mentioned the Registry. ASP.NET Web
Applications are software, running in a Windows environment. The
Registry is intended as a place for software to store configuration
data.
You will be deploying your project on a number of development, test and
production servers. Each of which could be pointed at its own Database
Server, document repository, etc. If you hardcode these settings into
a web.config file in your project, you will have to A) leave them out
of source control, B) trick your deploy script into not moving .config
files, or C) hand edit them each time you deploy. Any of these is a
recipe for disaster. Sooner or later, one of your junior devs will
inadvertantly push his local copy of web.config, and suddenly you'll
find the production site pointed at your development database.
With your configuration settings in the registry, you need only set the
box up once. Set it to point at its target database, and forget it.
As to compiling settings into a class? Yikes!!! As in you need to
recompile the project just to flip the database from Test to
Production??? No thanks!
Jason http://www.expatsoftware.com
> I'm surprised that nobody here has mentioned the Registry. ASP.NET Web Applications are software, running in a Windows environment. The Registry is intended as a place for software to store configuration data.
Actually the registry isn't a great place for daemon software like IIS and
ASP.NET for three reasons: 1) The worker process for ASP.NET runs under an
identity whose profile isn't fully loaded, therefore HKEY_CURRENT_USER isn't
available and 2) Since HKEY_CURRENT_USER isn't available then you'd need
to have greater permissions to write to HKEY_LOCAL_MACHINE and for security
reasons we don't want this. 3) It difficult to have the admin configure this
because you'd need to have the app running. But if the app requires the settings
to be configured prior to running then how do you configure them? It's sort
of a chicken and the egg problem...
-Brock
DevelopMentor http://staff.develop.com/ballen
re: I'm surprised that nobody here has mentioned the Registry.
Accessing the Registry is a fairly slow process.
While fine when checking to see if a user is a registered
user of an WinForms app or a Win32 application,
unless you have proof to the contrary, it seems that
checking a Registry seeting is going to have an adverse
effect on your web application's performance.
re: As to compiling settings into a class? Yikes!!! As in you need to recompile the project just to flip the database from Test to Production?
I don't know what "database" you're talking about.
Maybe we are talking about different scenarios.
If you are "testing" a Web app, you compile it as a "Debug"
application and, if you are deploying your application after it
has been debugged, then you'd compile it as a "Release" application.
If you know how to change from a "Debug" environment
to a "Release" environment without recompiling, please let
us know how that can be done.
Juan T. Llibre
ASP.NET MVP http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================
"jasonkester" <ja*********@gmail.com> wrote in message
news:11**********************@l41g2000cwc.googlegr oups.com... Linda (at) wrote: My question now is: What would be the appropriate way of dealing with this in .net?
I'm surprised that nobody here has mentioned the Registry. ASP.NET Web Applications are software, running in a Windows environment. The Registry is intended as a place for software to store configuration data.
You will be deploying your project on a number of development, test and production servers. Each of which could be pointed at its own Database Server, document repository, etc. If you hardcode these settings into a web.config file in your project, you will have to A) leave them out of source control, B) trick your deploy script into not moving .config files, or C) hand edit them each time you deploy. Any of these is a recipe for disaster. Sooner or later, one of your junior devs will inadvertantly push his local copy of web.config, and suddenly you'll find the production site pointed at your development database.
With your configuration settings in the registry, you need only set the box up once. Set it to point at its target database, and forget it.
As to compiling settings into a class? Yikes!!! As in you need to recompile the project just to flip the database from Test to Production??? No thanks!
Jason http://www.expatsoftware.com
Juan T. Llibre wrote: Accessing the Registry is a fairly slow process.
Indeed. But if you use a static constructor for your
ConnectionFactory, you only need to read from it once per IISRESET. As to compiling settings into a class? Yikes!!! As in you need to recompile the project just to flip the database from Test to Production?
I don't know what "database" you're talking about.
Maybe we are talking about different scenarios.
Database Server. Sorry if I was vague. You do all your development on
one database server, all your testing on another, and host your
production data on a third. The original poster was asking how to
manage the fact that your web application will need to use separate
connection strings in each of these three environments.
If you are "testing" a Web app, you compile it as a "Debug" application and, if you are deploying your application after it has been debugged, then you'd compile it as a "Release" application.
I beg to differ. If you are developing and debugging a web app, you
use "Debug". Once you throw it over the wall into Test, you want it to
be a Release build, since it will go on to Production if it passes QA.
It sounds like your release process involves recompiling a bunch of
configuration changes into your .dll, flipping it to Release, and
throwing it live, untested. You should probably talk this over with
your QA department. I bet they'll have some words for you!
Jason http://www.expatsoftware.com
Brock Allen wrote: Actually the registry isn't a great place for daemon software like
IIS and ASP.NET for three reasons[...] Since HKEY_CURRENT_USER isn't available then you'd need to have greater permissions to write to HKEY_LOCAL_MACHINE and for
security reasons we don't want this.
Writing configuration data? Remember, we're talking about READING
configuration data here. As in, using the Registry as an alternative
to reading connection strings and such from web.config. So yeah, of
course you'll want to stash things under HKEY_LOCAL_MACHINE. You'll
also want to avoid reading it with every page load, but that's what
static constructors are for.
3) It difficult to have the admin configure this because you'd need to have the app running.
The Admin will only need to configure this when he is building the box.
Install Windows, Install IIS, run the .REG, and you're good to go
indefinately.
But if the app requires the settings to be configured prior to running then how do you configure them?
It's sort of a chicken and the egg problem...
We must be talking about different things. Again, this is read-only
stuff that would otherwise be found in web.config. You're not saying
you have applications that modify their own web.config at runtime, are
you?
Jason http://www.expatsoftware.com
re: If you are "testing" a Web app, you compile it as a "Debug" application and, if you are deploying your application after it has been debugged, then you'd compile it as a "Release" application.
I beg to differ. If you are developing and debugging a web app, you use "Debug". Once you throw it over the wall into Test, you want it to be a Release build, since it will go on to Production if it passes QA.
Does that mean that, if it *doesn't* pass QA,
it goes back to the "Debug" stage ?
Or, will you continue to "test" new code in Release build mode ?
You have a penchant for semantic hair-splitting.
That's OK, though.
I have a feeling it's the same thought-process which prompted
you to hair-split on the Registry-read process being slower, too.
Juan T. Llibre
ASP.NET MVP http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================
"jasonkester" <ja*********@gmail.com> wrote in message
news:11*********************@l41g2000cwc.googlegro ups.com... Juan T. Llibre wrote: Accessing the Registry is a fairly slow process.
Indeed. But if you use a static constructor for your ConnectionFactory, you only need to read from it once per IISRESET. > As to compiling settings into a class? Yikes!!! As in you > need to recompile the project just to flip the database > from Test to Production?
I don't know what "database" you're talking about.
Maybe we are talking about different scenarios.
Database Server. Sorry if I was vague. You do all your development on one database server, all your testing on another, and host your production data on a third. The original poster was asking how to manage the fact that your web application will need to use separate connection strings in each of these three environments.
If you are "testing" a Web app, you compile it as a "Debug" application and, if you are deploying your application after it has been debugged, then you'd compile it as a "Release" application.
I beg to differ. If you are developing and debugging a web app, you use "Debug". Once you throw it over the wall into Test, you want it to be a Release build, since it will go on to Production if it passes QA.
It sounds like your release process involves recompiling a bunch of configuration changes into your .dll, flipping it to Release, and throwing it live, untested. You should probably talk this over with your QA department. I bet they'll have some words for you!
re: Install Windows, Install IIS, run the .REG, and you're good to go indefinately.
Until the slightest configuration change
requires that you modify the Windows Registry again.
Why introduce a complexity level which isn't *required* ?
Web.config is a perfectly good place for app settings.
If you're skittish about privacy, an assembly is *also*
a perfectly good place to place app settings.
Taking an application's settings outside an application's
AppDomain introduces retrieval/writing problems which
might be a severe application handicap down the road.
While for Windows Apps registry settings are a good idea,
for ASP.NET web applications they are unneeded and unwanted.
ASP.NET was developed, partly, to get *away* from
having to deal with Registry settings. Why go back now ?
Juan T. Llibre
ASP.NET MVP http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================
"jasonkester" <ja*********@gmail.com> wrote in message
news:11*********************@g14g2000cwa.googlegro ups.com... Brock Allen wrote: Actually the registry isn't a great place for daemon software like IIS and ASP.NET for three reasons[...] Since HKEY_CURRENT_USER isn't available then you'd need to have greater permissions to write to HKEY_LOCAL_MACHINE and for security reasons we don't want this.
Writing configuration data? Remember, we're talking about READING configuration data here. As in, using the Registry as an alternative to reading connection strings and such from web.config. So yeah, of course you'll want to stash things under HKEY_LOCAL_MACHINE. You'll also want to avoid reading it with every page load, but that's what static constructors are for.
3) It difficult to have the admin configure this because you'd need to have the app running.
The Admin will only need to configure this when he is building the box. Install Windows, Install IIS, run the .REG, and you're good to go indefinately.
But if the app requires the settings to be configured prior to running then how do you configure them? It's sort of a chicken and the egg problem...
We must be talking about different things. Again, this is read-only stuff that would otherwise be found in web.config. You're not saying you have applications that modify their own web.config at runtime, are you?
Jason http://www.expatsoftware.com
Juan T. Llibre wrote: re: Install Windows, Install IIS, run the .REG, and you're good to go indefinately.
Until the slightest configuration change requires that you modify the Windows Registry again.
I think we're using different definitions of "Configuration". I'm
talking about SERVER configuration. As in, "I am the Production
WebServer. I point at a database server named DB_LIVE." This is
information that must be set up once per box, and will never change.
Perhaps you are talking Application configuration. As in,
"HomePage=/index.aspx", "SomeAppGlobal=6", etc. This is information
that gets pushed out with every build, to every box. And yes, I'd
agree that it should be compiled into a .dll.
The nice thing about keeping your Server Configuration out of
web.config (or anything in the project) is that it's hard to
accidentily overwrite it. We've all worked with junior devs. This is
my safeguard against getting called in on a Saturday night to roll back
their mistakes.
Jason Kester
Expat Software Consulting Services http://www.expatsoftware.com/
Alright, after seeing your replies to Juan, I see what you're getting at
here. Sure, the registry would work for the things you're talking about.
But nothing says you can't make web.config read-only via DACLs. Neither one
is impervious to Junior Engineer Jimmy[1], though. My only question is why
go against the grain when the .config model is obviously the preferred method
in ASP.NET and the CLR? How would you then configure several different application
on the same machine? Or even several different sites? Not that you couldn't
with the registry, of course. It's only software, so anything's possible.
It's just that with the .config model those sorts of issues are non-issues.
As for the perf of reading, again, the existing model already caches these
settings in memory so it's unnecessary for you to build your own caching
mechanism. Or your own reload mechanism once the settings are changed. It's
myopic to think that settings never change, BTW.
I think your point of view is obviously a strong one based upon personal
experience, so if it works for your environment then that's great. There's
nothing wrong with it but I don't see enough compelling reasons in it to
recommend it to other people as a necessarily superior technique.
-Brock
DevelopMentor http://staff.develop.com/ballen
[1] Apologies to Mike Woodring [ http://www.bearcanyon.com] (he's not Jimmy,
BTW) Brock Allen wrote:
Actually the registry isn't a great place for daemon software like IIS and
ASP.NET for three reasons[...] Since HKEY_CURRENT_USER isn't available then you'd need to have greater permissions to write to HKEY_LOCAL_MACHINE and for security
reasons we don't want this. Writing configuration data? Remember, we're talking about READING configuration data here. As in, using the Registry as an alternative to reading connection strings and such from web.config. So yeah, of course you'll want to stash things under HKEY_LOCAL_MACHINE. You'll also want to avoid reading it with every page load, but that's what static constructors are for.
3) It difficult to have the admin configure this because you'd need to have the app running. The Admin will only need to configure this when he is building the box. Install Windows, Install IIS, run the .REG, and you're good to go indefinately. But if the app requires the settings to be configured prior to running then how do you configure them? It's sort
of a chicken and the egg problem... We must be talking about different things. Again, this is read-only stuff that would otherwise be found in web.config. You're not saying you have applications that modify their own web.config at runtime, are you?
Jason http://www.expatsoftware.com
re: I think we're using different definitions of "Configuration".
Indeed, we are.
re: The nice thing about keeping your Server Configuration out of web.config...is that it's hard to accidentily overwrite it.
Normally, whatever server configuration is allowable, from within
the .NET Framework, is taken care of at the machine.config level,
not at the web.config level.
As a Server Admin, you can set things up so that sensitive
machine.config settings cannot be overwritten by junior users.
Junior users shouldn't be developing
at the web server console, anyway. ;-)
Although, in your particular development environment, writing
to the Registry simply works, I'd hesitate before making that
the preferred method of setting server-wide settings.
We left ASP for ASP.NET so that
we wouldn't have to deal with the Registry.
I wouldn't recommend going back to it,
though it might work for you.
Juan T. Llibre
ASP.NET MVP http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================
"jasonkester" <ja*********@gmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com... Juan T. Llibre wrote: re: > Install Windows, Install IIS, run the .REG, > and you're good to go indefinately.
Until the slightest configuration change requires that you modify the Windows Registry again.
I think we're using different definitions of "Configuration". I'm talking about SERVER configuration. As in, "I am the Production WebServer. I point at a database server named DB_LIVE." This is information that must be set up once per box, and will never change.
Perhaps you are talking Application configuration. As in, "HomePage=/index.aspx", "SomeAppGlobal=6", etc. This is information that gets pushed out with every build, to every box. And yes, I'd agree that it should be compiled into a .dll.
The nice thing about keeping your Server Configuration out of web.config (or anything in the project) is that it's hard to accidentily overwrite it. We've all worked with junior devs. This is my safeguard against getting called in on a Saturday night to roll back their mistakes.
Jason Kester Expat Software Consulting Services http://www.expatsoftware.com/ This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Tom Willis |
last post by:
How are the expert pythoneers dealing with config files?
Is there anything similair to .net's config files or java's .properties?
A quick search on google didn't return anything that looked...
|
by: Michael J. Hudson |
last post by:
I'm not sure what good attaching a stylesheet to a Microsoft Word
document does. When you save the document as an HTML file, Word
throws in all of its style and font settings into the HTML file...
|
by: Igor Kramarsich - EDIT |
last post by:
I'm having problems dealing with dates in my queries/SQL code.
I need a search digit date. In form define date field without format I
receive results.
But I go to define date filed with short date...
|
by: Lenn |
last post by:
Hello,
Just some background: I'm developing an application that basically executes
series of tasks. So far I have 2 group of tasks run on different threads (2
different threads). Which run in...
|
by: SenthilVel |
last post by:
Hi
I am in the Process of conversion of my existing 1.1 Dotnet Code to 2.0
framework.
for each project when i compile in VS2005 , i get this error\warning:
Use command line option...
|
by: SenthilVel |
last post by:
Hi
I am in the Process of conversion of my existing 1.1 Dotnet Code to 2.0
framework.
for each project when i compile in VS2005 , i get this error\warning:
Use command line option...
|
by: Nathan Sokalski |
last post by:
I am trying to test out an ASP.NET web service I wrote, but the Add Web
Reference dialog gives me the following errors:
The proxy settings on this computer are not configured correctly for web...
|
by: RP |
last post by:
I am using SQL Server 2005 as backend. I have a Text Box that accepts
Date in the format dd-MM-yyyy. But when I attempt to insert a record,
an error is displayed: Cannot convert char to DateTime...
|
by: AmberJain |
last post by:
Windows Autorun FAQs: Programs dealing with autoruns
Linked from the Original article- "Windows Autorun FAQs: Description".
Que: Can you list programs that help me to view/modify the autoruns...
|
by: lllomh |
last post by:
Define the method first
this.state = {
buttonBackgroundColor: 'green',
isBlinking: false, // A new status is added to identify whether the button is blinking or not
}
autoStart=()=>{
|
by: DJRhino |
last post by:
Was curious if anyone else was having this same issue or not....
I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM)
The start time is equivalent to 19:00 (7PM) in Central...
|
by: Aliciasmith |
last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
|
by: tracyyun |
last post by:
Hello everyone,
I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
|
by: nia12 |
last post by:
Hi there,
I am very new to Access so apologies if any of this is obvious/not clear.
I am creating a data collection tool for health care employees to complete. It consists of a number of...
|
by: NeoPa |
last post by:
Introduction
For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
|
by: isladogs |
last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, Mike...
|
by: GKJR |
last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...
| |