Application Settings

G

Glenn Thimmes

I posted this question in the ASP.NET forum and did not get an answer, so I
thought this might be a better place.

I am needing to read and write application settings from within my ASP.NET
application. My web.config is not an option since I need to be able to write
settings as well. My database is not an option either as the database
location itself is one of the settings.

I've been trying to work with Isolated Storage, but it is obviously designed
to be user specific. I've attempted using Impersonation to load the same
settings for every session, but this doesn't really work. If I impersonate
my user account it works. If I impersonate the Administrator account it
works. But if I create a new user account on the machine and try to
impersonate that account, I just get the following error when trying to get
the isolated storage:

Unable to create the store directory.[The system cannot find the file
specified. ]

I've even made this new account an administrator, but I still get the same
results.

Is there a better way to do what I am trying to do? Isn't there
some simple method of saving and retrieving application wide settings in an
ASP.NET environment? I also should mention that it is required that I use
windows authentication for this site. When I turn that off, the IUSR account
works just great for saving and loading settings. But unfortunately I must
authenticate each use in order to use domain security for using Reporting
Services.

Thank you for any suggestions,

-Glenn Thimmes
 
J

Joe Kaplan \(MVP - ADSI\)

You might consider writing to an XML file in your VDIR if you have
permissions to do that on the server. You'd want to be sure that your file
isn't named such that it could be served by IIS though or your users may
download your settings. You could use a .config file extension to help with
that.

Another idea would be to use web.config for the read-only settings
(connection string) and then persist the read/write stuff to a database.
That's probably what I'd do.

Joe K.
 
G

Glenn Thimmes

Thanks for the suggestion, Joe. Since I'm using Windows authentication and I
don't wish to give every possible user permissions on my drive, I have been
resisting that option. I finally settled for creating an application user
profile and then impersonating that user just long enough to read and write
to the registry.


Joe Kaplan (MVP - ADSI) said:
You might consider writing to an XML file in your VDIR if you have
permissions to do that on the server. You'd want to be sure that your file
isn't named such that it could be served by IIS though or your users may
download your settings. You could use a .config file extension to help with
that.

Another idea would be to use web.config for the read-only settings
(connection string) and then persist the read/write stuff to a database.
That's probably what I'd do.

Joe K.


Glenn Thimmes said:
I posted this question in the ASP.NET forum and did not get an answer,
so
I
thought this might be a better place.

I am needing to read and write application settings from within my ASP.NET
application. My web.config is not an option since I need to be able to write
settings as well. My database is not an option either as the database
location itself is one of the settings.

I've been trying to work with Isolated Storage, but it is obviously designed
to be user specific. I've attempted using Impersonation to load the same
settings for every session, but this doesn't really work. If I impersonate
my user account it works. If I impersonate the Administrator account it
works. But if I create a new user account on the machine and try to
impersonate that account, I just get the following error when trying to get
the isolated storage:

Unable to create the store directory.[The system cannot find the file
specified. ]

I've even made this new account an administrator, but I still get the same
results.

Is there a better way to do what I am trying to do? Isn't there
some simple method of saving and retrieving application wide settings in an
ASP.NET environment? I also should mention that it is required that I use
windows authentication for this site. When I turn that off, the IUSR account
works just great for saving and loading settings. But unfortunately I must
authenticate each use in order to use domain security for using Reporting
Services.

Thank you for any suggestions,

-Glenn Thimmes
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top