Tuesday, 10 September 2013

First time run configuration (ASP MVC 4)

First time run configuration (ASP MVC 4)

I'm creating a simple MVC CMS for which I need a first time run
configuration (to set up the database and admin user account, etc.).
The setup screen will ask them for the database connection string, so at
first run, there is no knowledge of a database store.
How would I detect that this is the first time the application is being
run, and take them to that setup screen?
Should I put a setting in the web.config with an initial value of false:
<add key="SetupComplete" value="false" />
And once the setup is complete, I can change it via:
ConfigurationManager.AppSettings.Set("SetupComplete", "True");
The downfall of this method is that, if the application is restarted, the
config value will default to "false". What is a good solution to this
problem?

No comments:

Post a Comment