I have a webpage I am working on using asp.net mvc3. I am deploying it via appharbor which is amazing. The entire page is public, so I don’t need user authentication or anything like that, but there are administrative pages that only I should be able to access.
Rather than have any kind of authentication page with a password, I would like certain views to be only accessible while I am running it locally in debug mode, but not once I have deployed to appharbor.
Is there some kind of environment setting that I can use to:
- Show or hide page elements (links) based on whether it is running locally or on the server.
- Restrict access to entire views (return 403) if the application is running on appharbor.
How would I read and apply these settings in my views and controllers?
A crude way would be to use
as : http://haacked.com/archive/2007/09/16/conditional-compilation-constants-and-asp.net.aspx#51205
and Is there an #IF DEBUG for Asp.net markup?