Watermark in background for Debug build

D

David Slinn

I was wondering what the best way to acheive the following would be:

What I would like is for the background of every page in my ASP.NET web
project to contain a soft red GIF containing the word "TEST" when the
version being viewed has been compiled using the DEBUG build. Once we build
a release version and place that into production, we obviously want that
"watermark" to disappear.

Now, I suppose I could create two cascading style sheets, one containing a
body - background entry for test, the other without it for production. Is
this the best method, or is there another way?

- Dave
 
E

EijiTek

If you haven't done so already, you could create a base class for the pages
in your project and in one of the page events (probably PreRender) you could
dynamically add a control using a directive

[C#]
#if DEBUG
Page.Controls.Add(new LiteralControl("<img src=\"test.gif\" />"));
#endif

[VB.NET]
#If DEBUG Then
Page.Controls.Add(new LiteralControl("<img src=""test.gif"" />"))
#End If

If there is a specific place you wish to place the image you could use the
AddAt method of the ControlCollection.

(I may be a little off on the syntax for VB.NET since I have only been using
C#)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top