asp.net - Best way to modify MVC site to display that you're on a test site -


this question has answer here:

is there quick , easy way detect environment app running on , modify html accordingly?

i change shared layout view give header red background when running on test server.

i'd avoid writing iis module or http response filter if possible.

you can use filter attribute runs every action method , set property in every view's viewbag, example reading environment web.config. "it" being appsettings key "environment", or list of hostname , color mappings.

see how set viewbag properties views without using base class controllers? , mirak's answer.

then in layout, use viewbag property set html style or class.


Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -