views:

45

answers:

1

There is a PrintingPermission attribute in the framework which takes a PrintingPermissionLevel enumeration with one of these values;

  • NoPrinting: Prevents access to printers. NoPrinting is a subset of SafePrinting.
  • SafePrinting: Provides printing only from a restricted dialog box. SafePrinting is a subset of DefaultPrinting.
  • DefaultPrinting: Provides printing programmatically to the default printer, along with safe printing through semirestricted dialog box. DefaultPrinting is a subset of AllPrinting.
  • AllPrinting: Provides full access to all printers.

The documentation is really sparse, and I wondered if anyone can tell me more about the SafePrinting option. What does the documentation mean when it says "Provides printing only from a restricted dialog box." I have no idea what this means. Can anyone shed any light?

This subject is touched in the MS certification 70-505: TS: Microsoft .NET Framework 3.5, Windows Forms Application Development and so I'm keen to find out more.

+1  A: 

I don't see this actually implemented anywhere when peeking with Reflector. There is only one print dialog ever used, both by WF and WPF, the native Windows print dialog. It doesn't have a restricted version.

Printing support in .NET has been a bit cumbersome, it took a while before the System.Printing namespace became available. There might well have been early plans to implement a "better" print dialog, plans that didn't pan out.

I would guess that the exam question was more focused on testing understanding of CAS rather than very obscure details about the actual meaning of a specific CAS attribute.

Hans Passant
Thanks; I appreciate your efforts. The exams can be pretty... petty, sometimes. They'll check crappy little details like that. But I'm glad it doesn't do anything. I just have to remember that CAS _thinks_ it does ;)
Steve Cooper