Skip to content

Using Visual Studio 2012 Web Publish For Staging On The Internet

Updated: at 02:12 PM


Let’s say you have a production code like and you want to have a test site on the internet that will not be seen by anyone unless they login (or maybe even login as an admin).  Using web.config (with Visual Studio 2012), transformations makes that very straight forward.  I know because I just did that.  I created a test site (say: and set up my publish to replace my normal anonymous authentication (allowing anonymous users) to one that denies anonymous users.  Just as an aside, the reason I did this was I notice that google was indexing some of those pages even though my robots.txt file says to deny access to all robots.  Apparently some crawlers don’t respect that signal.

For a little background, I did publish some basics about doing transforms here:

So, here is what I have in my web.config file that is part of my normal project source control.


And, here is my transform file (Web.Test.config)


And, just to show the result, this is what end up on my test server:


And Finally, just for some extra bonus stuff here at the end, here is what my tranformation looks like that simply removes the debug option when I publish to production.


Check out the ORM (Object Relational Mapper) PRISMA. The database access method I use in all my projects