Solved

ASP.NET Stop users from Email Webpage

Posted on 2009-05-06
8
219 Views
Last Modified: 2012-08-13
Is this possible. I can stop the body of the page from printing when they click the print button.  Is there a way to stop users from email the page from File.Send To?

I know Javascript might be an option.  I just wondered is there is a command from the body tag that I could use.
0
Comment
Question by:aninec
  • 4
  • 3
8 Comments
 
LVL 4

Expert Comment

by:Wardy_01
ID: 24314791
No way to do this in .net since the command is fired by the browser "client side" and the code you write would be run on the server.

Javascript is likely your only option here, or maybe an active X component (browser plugin).
0
 
LVL 39

Expert Comment

by:abel
ID: 24314907
It is not possible to prevent that. Not by JavaScript and not from the serverside. You may try to create a plugin (XUL for FireFox, ActiveX for Microsoft IE) and ask the users to install it, but you may find some reluctance there.

Btw, you cannot stop the body of the page from printing when they click the print button. You can pull some tricks which may make it slightly harder, but anybody who wants to print your page can and will do that. Internet is a huge open source area and everything that can be viewed can be printed.

Even in the case where you manage to tie the hands of the end user, he or she can still print it by using printscreen, using another browser, disabling javascript, css or plugins, or simply using an older browser.

Same for emailing, which is just equal to save as, which is something you cannot prevent either.

If you want your content protected, you should publish it with PDF, which has protection mechanisms build in (which can, you guessed it, also be bend).
0
 

Author Comment

by:aninec
ID: 24319223
This is for an intranet and I am trying to protect content. I think I can use Javascript to control what the users can see.  Most would not have a clue that they could get around the coding...and the rest could careless.

Thanks for the assistance.  Now I need to figure how to code it for No toolbar and menu when the page loads up.
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 39

Expert Comment

by:abel
ID: 24319312
seems to be the day... You're the second that asks that today ;-)

The only way to manipulate the appearance of the browser (whether your users will see it as an annoyance is another subject) is by opening a new window. However, at any time, with all modern browsers, the user can get all buttons etc back. Furthermore, in most browsers it is now a custom that new windows are blocked anyway, and if not, they open in a new tab, which will still show the buttons and menu. And there's no way, no way at all (unless you write a plugin) to remove them. And even if you would manage (let's say by exploing a hole in the security), you will be considered a virus, I'm afraid....
0
 
LVL 39

Expert Comment

by:abel
ID: 24319333
But really: protecting content from the ones that do not know how to steal the content anyway, is not really going to bear fruit. And the ones that do want to steal your content, will know there ways around (and in the end it is only one click away to disable javascript).

Your best bet will be to deliver your protected content in any which way but HTML.
0
 
LVL 4

Expert Comment

by:Wardy_01
ID: 24372930
what about rendering the content in a new window with no toolbars and preventing right clicks.
that doesn't stop "print screen" of course but it does prevent direct printing to a printer.

Sharepoint has an option to do this with a document, how does sharepoint do it?
0
 
LVL 39

Accepted Solution

by:
abel earned 500 total points
ID: 24373011
what about the following (really you can't do much if somebody wants to print your page), which becomes more and more common as default settings... (other browsers have similar ways).

The only serious option is rendering your page as PDF, with the security bits set for printing.

If you want to be particularly annoying to users who want to print your page, add the following in your CSS file, it will have the average user look at a blanco page if (s)he prints it:

@media print 
{
   * {
       display: none !important;  
      /* the imp. will prevent user-overriding settings in many cases */
   }
}

Open in new window

ScreenShot274.png
0
 
LVL 4

Expert Comment

by:Wardy_01
ID: 24373130
oooo good call abel ... i like the css option ... cllean :)
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question