Can you use Settings.Settings file for ASP.Net sites also?
Asked Answered
A

2

6

I have a code base that has been used as an ASP.Net web application. It's now branching out and being used as part of two WinForms applications.

The main difference is that the WinForms apps should store their settings "per user" and the web app only needs to store the settings at the "application" level. They are the same settings, but stored differently depending on type of application.

Clarification: The same code will be used as the foundation for a web site application as well as the code base for a desktop application. In the desktop application the settings should be stored in the appropriate user directory, but that's not workable when the same code is running the web app. Hence the dilemma. How to switch from a web.config-type situation for the web app to a user.config-type situation (stored in the proper directory) for the desktop app.

Does anyone know if the settings.settings file is workable for a web app?

Is there a better way to store the same settings in two different ways?

Aerie answered 27/6, 2009 at 3:29 Comment(0)
A
3

Yes, you can use Settings.Settings files for web application projects. Set it up just like in your WinForms projects. With a web project, you are limited to Application scope though - you cannot create user-scoped settings.

Athematic answered 27/6, 2009 at 5:54 Comment(1)
I was not successful doing this. It required me to create a new class library project, but using the application scope, the settings were not assignable (read-only). How to do it?Cinquefoil
S
0

Without knowing more details about your app - perhaps storing the user data (or some other centralized repository) would be best. Then users could chose either platform and have access to their preferences and settings.

Scant answered 27/6, 2009 at 3:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.