Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET How can I write a message on the screen without the end user removing it?

Tags:

asp.net

I have written a ASP.NET program for a customer, I want to add a message similar to "Preview version, ABD Consulting" on the master.master page, I had thought to use Response.write but it messes up the look of the page as it seems to move page elemets. If I use a label the customer can remove it from the Master.master file, any suggestions? The customer is in a different country so I want to ensure I'm paid.

Many thanks

like image 259
LeeW Avatar asked Mar 08 '10 00:03

LeeW


3 Answers

Serve it on your own server. If it's a preview, they shouldn't have access to the code anyway.

like image 124
George Johnston Avatar answered Oct 21 '22 12:10

George Johnston


There is nothing you can do unless you host it or control the web server it runs on. Nothing you do in code will matter if they are smart enough. They can write their on HTTP Handlers and replace anything they want.

like image 3
rick schott Avatar answered Oct 21 '22 12:10

rick schott


If you programmatically write out the label during the OnPrerender or Render of the page then the client will not be able to remove it. If you then randomize the ID given to the element, they will find it incredibly hard to apply any javascript functions or CSS styles to it, especially if you directly add the styles to it.

Something like this (pseudo code):

HtmlGenericControl label = new HtmlGenericControl("div");
label.ID = Guid.NewGuid().ToString();
label.InnerText = "My copyright or ownership text";
label.Style.Add(HtmlTextWriterStyle.Height, "50px");
label.Style.Add(HtmlTextWriterStyle.Width, "100px");

if you then absolutely position it, it should always show up. Note that it isn't totally untouchable and fool proof, but you want to just make it hard enough that the client doesn't try to remove it.

like image 1
slugster Avatar answered Oct 21 '22 13:10

slugster