Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


ASP.NET Stop users from Email Webpage

Posted on 2009-05-06
Medium Priority
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.
Question by:aninec
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3

Expert Comment

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).
LVL 39

Expert Comment

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).

Author Comment

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.
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

LVL 39

Expert Comment

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....
LVL 39

Expert Comment

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.

Expert Comment

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?
LVL 39

Accepted Solution

abel earned 2000 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


Expert Comment

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

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

730 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