There are times that we need to hide the markup source from the published ASPX files. We have an option for that in the Visual Studio 2012 Update 2.
1) Right click on the web project from the solution explorer and choose Publish…
2) In the Publish Web dialog box, create a new profile (Or update an existing profile) and press Next > (Or choose the Connection tab). From there, choose your publish method (I’m using File System) and press Next >
3) In the Settings tab, expand the File Publish Options and tick Precompile during publishing.
4) Then click the Configure link next to Precompile during publishing option. It will open up a window shown as below. From there, un-tick Allow precompiled site to be updatable option and click OK.
5) Now you are done! Click Publish and it will publish the project. If you look in to the source code of ASPX, you will see the message “This is a marker file generated by the precompilation tool, and should not be deleted!”. But you can’t see the source code. If you look in to the bin folder of the published project, you will see additional files (Extension with .compiled) which are responsible for mapping the assembly code in to ASPX files.
For visual studio 2010 and Visual Studio 2012 (Without update), you will have to install the updates as describe in this link.