This could be considered a duplicate question, as a similar one has already been asked, but I don't like any of the answers, and security was not addressed.
When deploying an ASP.NET MVC app, what's the right way to create roles and a superuser without risks?
Two ways come to my mind: using Application_Start
or a custom action (better if with a non-obvious name and not linked).
Anyway, what about with first user's password?
I've seen tons of web apps that happily let the first person to access them to be the superuser; when you put such an app online, you can only pray to be the first to connect.
What is the most secure way to set password?
Hardcode it in the application?
Have it randomly generated and then mailed somewhere?
Have it randomly generated and then saved somewhere on filesystem?
Have it taken from a file on filesystem?
Something better that I couldn't figure out?