I am trying to find the definition of "Safe Printing" and cannot find out
exactly what this entitles. The reason is that I am trying to print
contents from a single textbox to no avail using the PrintDialog control
under a security setting with only SafePrinting allowed.
I have attached a sample project that I am using to try to accomplish this.
The print dialog appears, but when I press the Print button, I get an
exception (at the end of this message). Any ideas how I can make this work?
Thanks,
Jody
System.Security .SecurityExcept ion: Request for the permission of type
System.Drawing. Printing.Printi ngPermission, System.Drawing,
Version=1.0.500 0.0, Culture=neutral , PublicKeyToken= b03f5f7f11d50a3 a failed.
at System.Security .CodeAccessSecu rityEngine.Chec kHelper(Permiss ionSet
grantedSet, PermissionSet deniedSet, CodeAccessPermi ssion demand,
PermissionToken permToken)
at System.Security .CodeAccessSecu rityEngine.Chec k(PermissionTok en
permToken, CodeAccessPermi ssion demand, StackCrawlMark& stackMark, Int32
checkFrames, Int32 unrestrictedOve rride)
at System.Security .CodeAccessSecu rityEngine.Chec k(CodeAccessPer mission
cap, StackCrawlMark& stackMark)
at System.Security .CodeAccessPerm ission.Demand()
at System.Drawing. Printing.Printe rSettings.SetHd evmode(IntPtr hdevmode)
at System.Windows. Forms.PrintDial og.UpdatePrinte rSettings(PRINT DLG data,
PrinterSettings settings, PageSettings pageSettings)
at System.Windows. Forms.PrintDial og.RunDialog(In tPtr hwndOwner)
at System.Windows. Forms.CommonDia log.ShowDialog( )
at PrintTest.Form1 .Button1_Click( Object sender, EventArgs e)
at System.Windows. Forms.Control.O nClick(EventArg s e)
at System.Windows. Forms.Button.On Click(EventArgs e)
at System.Windows. Forms.Button.On MouseUp(MouseEv entArgs mevent)
at System.Windows. Forms.Control.W mMouseUp(Messag e& m, MouseButtons
button, Int32 clicks)
at System.Windows. Forms.Control.W ndProc(Message& m)
at System.Windows. Forms.ButtonBas e.WndProc(Messa ge& m)
at System.Windows. Forms.Button.Wn dProc(Message& m)
at System.Windows. Forms.ControlNa tiveWindow.OnMe ssage(Message& m)
at System.Windows. Forms.ControlNa tiveWindow.WndP roc(Message& m)
at System.Windows. Forms.NativeWin dow.Callback(In tPtr hWnd, Int32 msg,
IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
mscorlib
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase:
file:///c:/windows/microsoft.net/framework/v1.1.4322/mscorlib.dll
----------------------------------------
System.Drawing
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase:
file:///c:/windows/assembly/gac/system.drawing/1.0.5000.0__b03 f5f7f11d50a3a/system.drawing. dll
----------------------------------------
System
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase:
file:///c:/windows/assembly/gac/system/1.0.5000.0__b77 a5c561934e089/system.dll
----------------------------------------
RegexAssembly4_ 0
Assembly Version: 0.0.0.0
Win32 Version: n/a
CodeBase:
----------------------------------------
IEExecRemote
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase:
file:///c:/windows/assembly/gac/ieexecremote/1.0.5000.0__b03 f5f7f11d50a3a/ieexecremote.dl l
----------------------------------------
PrintTest
Assembly Version: 1.0.1468.23656
Win32 Version: n/a
CodeBase: http://192.168.0.33/VistaNETtest/Testing/PrintTest.EXE
----------------------------------------
System.Windows. Forms
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase:
file:///c:/windows/assembly/gac/system.windows. forms/1.0.5000.0__b77 a5c561934e089/system.windows. forms.dll
----------------------------------------
System.Xml
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase:
file:///c:/windows/assembly/gac/system.xml/1.0.5000.0__b77 a5c561934e089/system.xml.dll
----------------------------------------
Microsoft.Visua lBasic
Assembly Version: 7.0.5000.0
Win32 Version: 7.10.3052.4
CodeBase:
file:///c:/windows/assembly/gac/microsoft.visua lbasic/7.0.5000.0__b03 f5f7f11d50a3a/microsoft.visua lbasic.dll
----------------------------------------
************** JIT Debugging **************
To enable just in time (JIT) debugging, the config file for this
application or machine (machine.config ) must have the
jitDebugging value set in the system.windows. forms section.
The application must also be compiled with debugging
enabled. 9 4113
Jody,
I can not access your sample code. Could you please post a link to
or email me your code.
Ken
----------------
"Jody Gelowitz" <jo**@mail.visu alstatement.com > wrote in message
news:uz******** ******@TK2MSFTN GP09.phx.gbl... I am trying to find the definition of "Safe Printing" and cannot find out exactly what this entitles. The reason is that I am trying to print contents from a single textbox to no avail using the PrintDialog control under a security setting with only SafePrinting allowed.
I have attached a sample project that I am using to try to accomplish this. The print dialog appears, but when I press the Print button, I get an exception (at the end of this message). Any ideas how I can make this work?
Thanks, Jody
System.Security .SecurityExcept ion: Request for the permission of type System.Drawing. Printing.Printi ngPermission, System.Drawing, Version=1.0.500 0.0, Culture=neutral , PublicKeyToken= b03f5f7f11d50a3 a failed. at System.Security .CodeAccessSecu rityEngine.Chec kHelper(Permiss ionSet grantedSet, PermissionSet deniedSet, CodeAccessPermi ssion demand, PermissionToken permToken) at System.Security .CodeAccessSecu rityEngine.Chec k(PermissionTok en permToken, CodeAccessPermi ssion demand, StackCrawlMark& stackMark, Int32 checkFrames, Int32 unrestrictedOve rride) at System.Security .CodeAccessSecu rityEngine.Chec k(CodeAccessPer mission cap, StackCrawlMark& stackMark) at System.Security .CodeAccessPerm ission.Demand() at System.Drawing. Printing.Printe rSettings.SetHd evmode(IntPtr hdevmode) at System.Windows. Forms.PrintDial og.UpdatePrinte rSettings(PRINT DLG data, PrinterSettings settings, PageSettings pageSettings) at System.Windows. Forms.PrintDial og.RunDialog(In tPtr hwndOwner) at System.Windows. Forms.CommonDia log.ShowDialog( ) at PrintTest.Form1 .Button1_Click( Object sender, EventArgs e) at System.Windows. Forms.Control.O nClick(EventArg s e) at System.Windows. Forms.Button.On Click(EventArgs e) at System.Windows. Forms.Button.On MouseUp(MouseEv entArgs mevent) at System.Windows. Forms.Control.W mMouseUp(Messag e& m, MouseButtons button, Int32 clicks) at System.Windows. Forms.Control.W ndProc(Message& m) at System.Windows. Forms.ButtonBas e.WndProc(Messa ge& m) at System.Windows. Forms.Button.Wn dProc(Message& m) at System.Windows. Forms.ControlNa tiveWindow.OnMe ssage(Message& m) at System.Windows. Forms.ControlNa tiveWindow.WndP roc(Message& m) at System.Windows. Forms.NativeWin dow.Callback(In tPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies ************** mscorlib Assembly Version: 1.0.5000.0 Win32 Version: 1.1.4322.573 CodeBase: file:///c:/windows/microsoft.net/framework/v1.1.4322/mscorlib.dll ---------------------------------------- System.Drawing Assembly Version: 1.0.5000.0 Win32 Version: 1.1.4322.573 CodeBase: file:///c:/windows/assembly/gac/system.drawing/1.0.5000.0__b03 f5f7f11d50a3a/system.drawing. dll ---------------------------------------- System Assembly Version: 1.0.5000.0 Win32 Version: 1.1.4322.573 CodeBase: file:///c:/windows/assembly/gac/system/1.0.5000.0__b77 a5c561934e089/system.dll ---------------------------------------- RegexAssembly4_ 0 Assembly Version: 0.0.0.0 Win32 Version: n/a CodeBase: ---------------------------------------- IEExecRemote Assembly Version: 1.0.5000.0 Win32 Version: 1.1.4322.573 CodeBase: file:///c:/windows/assembly/gac/ieexecremote/1.0.5000.0__b03 f5f7f11d50a3a/ieexecremote.dl l ---------------------------------------- PrintTest Assembly Version: 1.0.1468.23656 Win32 Version: n/a CodeBase: http://192.168.0.33/VistaNETtest/Testing/PrintTest.EXE ---------------------------------------- System.Windows. Forms Assembly Version: 1.0.5000.0 Win32 Version: 1.1.4322.573 CodeBase: file:///c:/windows/assembly/gac/system.windows. forms/1.0.5000.0__b77 a5c561934e089/system.windows. forms.dll ---------------------------------------- System.Xml Assembly Version: 1.0.5000.0 Win32 Version: 1.1.4322.573 CodeBase: file:///c:/windows/assembly/gac/system.xml/1.0.5000.0__b77 a5c561934e089/system.xml.dll ---------------------------------------- Microsoft.Visua lBasic Assembly Version: 7.0.5000.0 Win32 Version: 7.10.3052.4 CodeBase: file:///c:/windows/assembly/gac/microsoft.visua lbasic/7.0.5000.0__b03 f5f7f11d50a3a/microsoft.visua lbasic.dll ----------------------------------------
************** JIT Debugging ************** To enable just in time (JIT) debugging, the config file for this application or machine (machine.config ) must have the jitDebugging value set in the system.windows. forms section. The application must also be compiled with debugging enabled.
The code in question is as follows:
With dlgPrintSetting s
If Not (.ShowDialog() = DialogResult.Ca ncel) Then
Try
TextBox1.Append Text("Printing ..." & ControlChars.Cr Lf)
..Document.Prin t()
TextBox1.Append Text("Print Successful")
Catch ex As Exception
Debug.WriteLine (ex.ToString)
'MsgBox(ex.ToSt ring)
End Try
End If
End With
The security exception is thrown within the following line:
If Not (.ShowDialog() = DialogResult.Ca ncel) Then
after you click the PRINT button. The line below it never gets called:
TextBox1.Append Text("Printing ..." & ControlChars.Cr Lf)
Thanks,
Jody
"Ken Tucker [MVP]" <vb***@bellsout h.net> wrote in message
news:ur******** ******@TK2MSFTN GP09.phx.gbl... Jody,
I can not access your sample code. Could you please post a link
to or email me your code.
Ken ---------------- "Jody Gelowitz" <jo**@mail.visu alstatement.com > wrote in message news:uz******** ******@TK2MSFTN GP09.phx.gbl...I am trying to find the definition of "Safe Printing" and cannot find out exactly what this entitles. The reason is that I am trying to print contents from a single textbox to no avail using the PrintDialog control under a security setting with only SafePrinting allowed.
I have attached a sample project that I am using to try to accomplish this. The print dialog appears, but when I press the Print button, I get an exception (at the end of this message). Any ideas how I can make this work?
Thanks, Jody
System.Security .SecurityExcept ion: Request for the permission of type System.Drawing. Printing.Printi ngPermission, System.Drawing, Version=1.0.500 0.0, Culture=neutral , PublicKeyToken= b03f5f7f11d50a3 a failed. at System.Security .CodeAccessSecu rityEngine.Chec kHelper(Permiss ionSet grantedSet, PermissionSet deniedSet, CodeAccessPermi ssion demand, PermissionToken permToken) at System.Security .CodeAccessSecu rityEngine.Chec k(PermissionTok en permToken, CodeAccessPermi ssion demand, StackCrawlMark& stackMark, Int32 checkFrames, Int32 unrestrictedOve rride) at System.Security .CodeAccessSecu rityEngine.Chec k(CodeAccessPer mission cap, StackCrawlMark& stackMark) at System.Security .CodeAccessPerm ission.Demand() at System.Drawing. Printing.Printe rSettings.SetHd evmode(IntPtr
hdevmode) at System.Windows. Forms.PrintDial og.UpdatePrinte rSettings(PRINT DLG
data, PrinterSettings settings, PageSettings pageSettings) at System.Windows. Forms.PrintDial og.RunDialog(In tPtr hwndOwner) at System.Windows. Forms.CommonDia log.ShowDialog( ) at PrintTest.Form1 .Button1_Click( Object sender, EventArgs e) at System.Windows. Forms.Control.O nClick(EventArg s e) at System.Windows. Forms.Button.On Click(EventArgs e) at System.Windows. Forms.Button.On MouseUp(MouseEv entArgs mevent) at System.Windows. Forms.Control.W mMouseUp(Messag e& m, MouseButtons button, Int32 clicks) at System.Windows. Forms.Control.W ndProc(Message& m) at System.Windows. Forms.ButtonBas e.WndProc(Messa ge& m) at System.Windows. Forms.Button.Wn dProc(Message& m) at System.Windows. Forms.ControlNa tiveWindow.OnMe ssage(Message& m) at System.Windows. Forms.ControlNa tiveWindow.WndP roc(Message& m) at System.Windows. Forms.NativeWin dow.Callback(In tPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies ************** mscorlib Assembly Version: 1.0.5000.0 Win32 Version: 1.1.4322.573 CodeBase: file:///c:/windows/microsoft.net/framework/v1.1.4322/mscorlib.dll ---------------------------------------- System.Drawing Assembly Version: 1.0.5000.0 Win32 Version: 1.1.4322.573 CodeBase:
file:///c:/windows/assembly/gac/system.drawing/1.0.5000.0__b03 f5f7f11d50a3a/system.drawing. dll ---------------------------------------- System Assembly Version: 1.0.5000.0 Win32 Version: 1.1.4322.573 CodeBase:
file:///c:/windows/assembly/gac/system/1.0.5000.0__b77 a5c561934e089/system.dll ---------------------------------------- RegexAssembly4_ 0 Assembly Version: 0.0.0.0 Win32 Version: n/a CodeBase: ---------------------------------------- IEExecRemote Assembly Version: 1.0.5000.0 Win32 Version: 1.1.4322.573 CodeBase:
file:///c:/windows/assembly/gac/ieexecremote/1.0.5000.0__b03 f5f7f11d50a3a/ieexecremote.dl l ---------------------------------------- PrintTest Assembly Version: 1.0.1468.23656 Win32 Version: n/a CodeBase: http://192.168.0.33/VistaNETtest/Testing/PrintTest.EXE ---------------------------------------- System.Windows. Forms Assembly Version: 1.0.5000.0 Win32 Version: 1.1.4322.573 CodeBase:
file:///c:/windows/assembly/gac/system.windows. forms/1.0.5000.0__b77 a5c561934e089/system.windows. forms.dll ---------------------------------------- System.Xml Assembly Version: 1.0.5000.0 Win32 Version: 1.1.4322.573 CodeBase:
file:///c:/windows/assembly/gac/system.xml/1.0.5000.0__b77 a5c561934e089/system.xml.dll ---------------------------------------- Microsoft.Visua lBasic Assembly Version: 7.0.5000.0 Win32 Version: 7.10.3052.4 CodeBase:
file:///c:/windows/assembly/gac/microsoft.visua lbasic/7.0.5000.0__b03 f5f7f11d50a3a/microsoft.visua lbasic.dll ----------------------------------------
************** JIT Debugging ************** To enable just in time (JIT) debugging, the config file for this application or machine (machine.config ) must have the jitDebugging value set in the system.windows. forms section. The application must also be compiled with debugging enabled.
Hi,
Try this code. Do you get any errors ?
'Check to see if we have printing rights
Dim Allperm As Security.IPermi ssion = New
Drawing.Printin g.PrintingPermi ssion(Drawing.P rinting.Printin gPermissionLeve l.AllPrinting)
Dim Defaultperm As Security.IPermi ssion = New
Drawing.Printin g.PrintingPermi ssion(Drawing.P rinting.Printin gPermissionLeve l.DefaultPrinti ng)
Dim Safeperm As Security.IPermi ssion = New
Drawing.Printin g.PrintingPermi ssion(Drawing.P rinting.Printin gPermissionLeve l.SafePrinting)
Try
Allperm.Demand( )
Defaultperm.Dem and()
Safeperm.Demand ()
Catch ex As Exception
MessageBox.Show (ex.ToString)
End Try
Ken
----------------------
"Jody Gelowitz" <jo**@mail.visu alstatement.com > wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. .. The code in question is as follows:
With dlgPrintSetting s
If Not (.ShowDialog() = DialogResult.Ca ncel) Then
Try
TextBox1.Append Text("Printing ..." & ControlChars.Cr Lf)
.Document.Print ()
TextBox1.Append Text("Print Successful")
Catch ex As Exception
Debug.WriteLine (ex.ToString)
'MsgBox(ex.ToSt ring)
End Try
End If
End With The security exception is thrown within the following line:
If Not (.ShowDialog() = DialogResult.Ca ncel) Then
after you click the PRINT button. The line below it never gets called:
TextBox1.Append Text("Printing ..." & ControlChars.Cr Lf) Thanks, Jody
"Ken Tucker [MVP]" <vb***@bellsout h.net> wrote in message news:ur******** ******@TK2MSFTN GP09.phx.gbl... Jody,
I can not access your sample code. Could you please post a link to or email me your code.
Ken ---------------- "Jody Gelowitz" <jo**@mail.visu alstatement.com > wrote in message news:uz******** ******@TK2MSFTN GP09.phx.gbl... >I am trying to find the definition of "Safe Printing" and cannot find >out > exactly what this entitles. The reason is that I am trying to print > contents from a single textbox to no avail using the PrintDialog > control > under a security setting with only SafePrinting allowed. > > I have attached a sample project that I am using to try to accomplish > this. > The print dialog appears, but when I press the Print button, I get an > exception (at the end of this message). Any ideas how I can make this > work? > > Thanks, > Jody > > > System.Security .SecurityExcept ion: Request for the permission of type > System.Drawing. Printing.Printi ngPermission, System.Drawing, > Version=1.0.500 0.0, Culture=neutral , PublicKeyToken= b03f5f7f11d50a3 a > failed. > at System.Security .CodeAccessSecu rityEngine.Chec kHelper(Permiss ionSet > grantedSet, PermissionSet deniedSet, CodeAccessPermi ssion demand, > PermissionToken permToken) > at System.Security .CodeAccessSecu rityEngine.Chec k(PermissionTok en > permToken, CodeAccessPermi ssion demand, StackCrawlMark& stackMark, > Int32 > checkFrames, Int32 unrestrictedOve rride) > at > System.Security .CodeAccessSecu rityEngine.Chec k(CodeAccessPer mission > cap, StackCrawlMark& stackMark) > at System.Security .CodeAccessPerm ission.Demand() > at System.Drawing. Printing.Printe rSettings.SetHd evmode(IntPtr hdevmode) > at System.Windows. Forms.PrintDial og.UpdatePrinte rSettings(PRINT DLG data, > PrinterSettings settings, PageSettings pageSettings) > at System.Windows. Forms.PrintDial og.RunDialog(In tPtr hwndOwner) > at System.Windows. Forms.CommonDia log.ShowDialog( ) > at PrintTest.Form1 .Button1_Click( Object sender, EventArgs e) > at System.Windows. Forms.Control.O nClick(EventArg s e) > at System.Windows. Forms.Button.On Click(EventArgs e) > at System.Windows. Forms.Button.On MouseUp(MouseEv entArgs mevent) > at System.Windows. Forms.Control.W mMouseUp(Messag e& m, MouseButtons > button, Int32 clicks) > at System.Windows. Forms.Control.W ndProc(Message& m) > at System.Windows. Forms.ButtonBas e.WndProc(Messa ge& m) > at System.Windows. Forms.Button.Wn dProc(Message& m) > at System.Windows. Forms.ControlNa tiveWindow.OnMe ssage(Message& m) > at System.Windows. Forms.ControlNa tiveWindow.WndP roc(Message& m) > at System.Windows. Forms.NativeWin dow.Callback(In tPtr hWnd, Int32 msg, > IntPtr wparam, IntPtr lparam) > > > ************** Loaded Assemblies ************** > mscorlib > Assembly Version: 1.0.5000.0 > Win32 Version: 1.1.4322.573 > CodeBase: > file:///c:/windows/microsoft.net/framework/v1.1.4322/mscorlib.dll > ---------------------------------------- > System.Drawing > Assembly Version: 1.0.5000.0 > Win32 Version: 1.1.4322.573 > CodeBase: > file:///c:/windows/assembly/gac/system.drawing/1.0.5000.0__b03 f5f7f11d50a3a/system.drawing. dll > ---------------------------------------- > System > Assembly Version: 1.0.5000.0 > Win32 Version: 1.1.4322.573 > CodeBase: > file:///c:/windows/assembly/gac/system/1.0.5000.0__b77 a5c561934e089/system.dll > ---------------------------------------- > RegexAssembly4_ 0 > Assembly Version: 0.0.0.0 > Win32 Version: n/a > CodeBase: > ---------------------------------------- > IEExecRemote > Assembly Version: 1.0.5000.0 > Win32 Version: 1.1.4322.573 > CodeBase: > file:///c:/windows/assembly/gac/ieexecremote/1.0.5000.0__b03 f5f7f11d50a3a/ieexecremote.dl l > ---------------------------------------- > PrintTest > Assembly Version: 1.0.1468.23656 > Win32 Version: n/a > CodeBase: http://192.168.0.33/VistaNETtest/Testing/PrintTest.EXE > ---------------------------------------- > System.Windows. Forms > Assembly Version: 1.0.5000.0 > Win32 Version: 1.1.4322.573 > CodeBase: > file:///c:/windows/assembly/gac/system.windows. forms/1.0.5000.0__b77 a5c561934e089/system.windows. forms.dll > ---------------------------------------- > System.Xml > Assembly Version: 1.0.5000.0 > Win32 Version: 1.1.4322.573 > CodeBase: > file:///c:/windows/assembly/gac/system.xml/1.0.5000.0__b77 a5c561934e089/system.xml.dll > ---------------------------------------- > Microsoft.Visua lBasic > Assembly Version: 7.0.5000.0 > Win32 Version: 7.10.3052.4 > CodeBase: > file:///c:/windows/assembly/gac/microsoft.visua lbasic/7.0.5000.0__b03 f5f7f11d50a3a/microsoft.visua lbasic.dll > ---------------------------------------- > > ************** JIT Debugging ************** > To enable just in time (JIT) debugging, the config file for this > application or machine (machine.config ) must have the > jitDebugging value set in the system.windows. forms section. > The application must also be compiled with debugging > enabled. > > >
Here's the permission requirements I get when I check your application:
<IPermission class="System.S ecurity.Permiss ions.Environmen tPermission,
mscorlib, Version=1.0.500 0.0, Culture=neutral ,
PublicKeyToken= b77a5c561934e08 9"
version="1"
Unrestricted="t rue"/>
<IPermission class="System.S ecurity.Permiss ions.FileIOPerm ission, mscorlib,
Version=1.0.500 0.0, Culture=neutral , PublicKeyToken= b77a5c561934e08 9"
version="1"
Unrestricted="t rue"/>
<IPermission class="System.S ecurity.Permiss ions.SecurityPe rmission,
mscorlib, Version=1.0.500 0.0, Culture=neutral ,
PublicKeyToken= b77a5c561934e08 9"
version="1"
Flags="Unmanage dCode, ControlEvidence "/>
<IPermission class="System.S ecurity.Permiss ions.UIPermissi on, mscorlib,
Version=1.0.500 0.0, Culture=neutral , PublicKeyToken= b77a5c561934e08 9"
version="1"
Unrestricted="t rue"/>
<IPermission class="System.N et.WebPermissio n, System, Version=1.0.500 0.0,
Culture=neutral , PublicKeyToken= b77a5c561934e08 9"
version="1"
Unrestricted="t rue"/>
=============== =============== =============== =============== =============== =
====
Shel
--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at http://www.microsoft.com/info/cpyright.htm
"Jody Gelowitz" <jo**@mail.visu alstatement.com > wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. .. The code in question is as follows:
With dlgPrintSetting s
If Not (.ShowDialog() = DialogResult.Ca ncel) Then
Try
TextBox1.Append Text("Printing ..." & ControlChars.Cr Lf)
.Document.Print ()
TextBox1.Append Text("Print Successful")
Catch ex As Exception
Debug.WriteLine (ex.ToString)
'MsgBox(ex.ToSt ring)
End Try
End If
End With The security exception is thrown within the following line:
If Not (.ShowDialog() = DialogResult.Ca ncel) Then
after you click the PRINT button. The line below it never gets called:
TextBox1.Append Text("Printing ..." & ControlChars.Cr Lf) Thanks, Jody
"Ken Tucker [MVP]" <vb***@bellsout h.net> wrote in message news:ur******** ******@TK2MSFTN GP09.phx.gbl... Jody,
I can not access your sample code. Could you please post a link to or email me your code.
Ken ---------------- "Jody Gelowitz" <jo**@mail.visu alstatement.com > wrote in message news:uz******** ******@TK2MSFTN GP09.phx.gbl...I am trying to find the definition of "Safe Printing" and cannot find
out exactly what this entitles. The reason is that I am trying to print contents from a single textbox to no avail using the PrintDialog
control under a security setting with only SafePrinting allowed.
I have attached a sample project that I am using to try to accomplish this. The print dialog appears, but when I press the Print button, I get an exception (at the end of this message). Any ideas how I can make this work?
Thanks, Jody
System.Security .SecurityExcept ion: Request for the permission of type System.Drawing. Printing.Printi ngPermission, System.Drawing, Version=1.0.500 0.0, Culture=neutral , PublicKeyToken= b03f5f7f11d50a3 a failed. at
System.Security .CodeAccessSecu rityEngine.Chec kHelper(Permiss ionSet grantedSet, PermissionSet deniedSet, CodeAccessPermi ssion demand, PermissionToken permToken) at System.Security .CodeAccessSecu rityEngine.Chec k(PermissionTok en permToken, CodeAccessPermi ssion demand, StackCrawlMark& stackMark,
Int32 checkFrames, Int32 unrestrictedOve rride) at
System.Security .CodeAccessSecu rityEngine.Chec k(CodeAccessPer mission cap, StackCrawlMark& stackMark) at System.Security .CodeAccessPerm ission.Demand() at System.Drawing. Printing.Printe rSettings.SetHd evmode(IntPtr hdevmode) at System.Windows. Forms.PrintDial og.UpdatePrinte rSettings(PRINT DLG data, PrinterSettings settings, PageSettings pageSettings) at System.Windows. Forms.PrintDial og.RunDialog(In tPtr hwndOwner) at System.Windows. Forms.CommonDia log.ShowDialog( ) at PrintTest.Form1 .Button1_Click( Object sender, EventArgs e) at System.Windows. Forms.Control.O nClick(EventArg s e) at System.Windows. Forms.Button.On Click(EventArgs e) at System.Windows. Forms.Button.On MouseUp(MouseEv entArgs mevent) at System.Windows. Forms.Control.W mMouseUp(Messag e& m, MouseButtons button, Int32 clicks) at System.Windows. Forms.Control.W ndProc(Message& m) at System.Windows. Forms.ButtonBas e.WndProc(Messa ge& m) at System.Windows. Forms.Button.Wn dProc(Message& m) at System.Windows. Forms.ControlNa tiveWindow.OnMe ssage(Message& m) at System.Windows. Forms.ControlNa tiveWindow.WndP roc(Message& m) at System.Windows. Forms.NativeWin dow.Callback(In tPtr hWnd, Int32
msg, IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies ************** mscorlib Assembly Version: 1.0.5000.0 Win32 Version: 1.1.4322.573 CodeBase: file:///c:/windows/microsoft.net/framework/v1.1.4322/mscorlib.dll ---------------------------------------- System.Drawing Assembly Version: 1.0.5000.0 Win32 Version: 1.1.4322.573 CodeBase:
file:///c:/windows/assembly/gac/system.drawing/1.0.5000.0__b03 f5f7f11d50a3a/system.drawing. dll ---------------------------------------- System Assembly Version: 1.0.5000.0 Win32 Version: 1.1.4322.573 CodeBase:
file:///c:/windows/assembly/gac/system/1.0.5000.0__b77 a5c561934e089/system.dll ---------------------------------------- RegexAssembly4_ 0 Assembly Version: 0.0.0.0 Win32 Version: n/a CodeBase: ---------------------------------------- IEExecRemote Assembly Version: 1.0.5000.0 Win32 Version: 1.1.4322.573 CodeBase:
file:///c:/windows/assembly/gac/ieexecremote/1.0.5000.0__b03 f5f7f11d50a3a/ieexecremote.dl l ---------------------------------------- PrintTest Assembly Version: 1.0.1468.23656 Win32 Version: n/a CodeBase: http://192.168.0.33/VistaNETtest/Testing/PrintTest.EXE ---------------------------------------- System.Windows. Forms Assembly Version: 1.0.5000.0 Win32 Version: 1.1.4322.573 CodeBase:
file:///c:/windows/assembly/gac/system.windows. forms/1.0.5000.0__b77 a5c561934e089/system.windows. forms.dll ---------------------------------------- System.Xml Assembly Version: 1.0.5000.0 Win32 Version: 1.1.4322.573 CodeBase:
file:///c:/windows/assembly/gac/system.xml/1.0.5000.0__b77 a5c561934e089/system.xml.dll ---------------------------------------- Microsoft.Visua lBasic Assembly Version: 7.0.5000.0 Win32 Version: 7.10.3052.4 CodeBase:
file:///c:/windows/assembly/gac/microsoft.visua lbasic/7.0.5000.0__b03 f5f7f11d50a3a/microsoft.visua lbasic.dll ----------------------------------------
************** JIT Debugging ************** To enable just in time (JIT) debugging, the config file for this application or machine (machine.config ) must have the jitDebugging value set in the system.windows. forms section. The application must also be compiled with debugging enabled.
Let me admend this, you'll also need safe printing. Just to display the
dialog box you're going to need unrestricted UIPermission, then to perform
the printing you'll need the safe printing permission. Was able to run your
app to completion with safe printing permission. You may not need all the
other permissions I came up with, you might try experimenting.
Shel
--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at http://www.microsoft.com/info/cpyright.htm
"Shel Blauman [MSFT]" <sh******@onlin e.microsoft.com > wrote in message
news:e2******** **********@TK2M SFTNGP10.phx.gb l... Here's the permission requirements I get when I check your application:
<IPermission class="System.S ecurity.Permiss ions.Environmen tPermission, mscorlib, Version=1.0.500 0.0, Culture=neutral , PublicKeyToken= b77a5c561934e08 9" version="1" Unrestricted="t rue"/> <IPermission class="System.S ecurity.Permiss ions.FileIOPerm ission,
mscorlib, Version=1.0.500 0.0, Culture=neutral , PublicKeyToken= b77a5c561934e08 9" version="1" Unrestricted="t rue"/> <IPermission class="System.S ecurity.Permiss ions.SecurityPe rmission, mscorlib, Version=1.0.500 0.0, Culture=neutral , PublicKeyToken= b77a5c561934e08 9" version="1" Flags="Unmanage dCode, ControlEvidence "/> <IPermission class="System.S ecurity.Permiss ions.UIPermissi on, mscorlib, Version=1.0.500 0.0, Culture=neutral , PublicKeyToken= b77a5c561934e08 9" version="1" Unrestricted="t rue"/> <IPermission class="System.N et.WebPermissio n, System, Version=1.0.500 0.0, Culture=neutral , PublicKeyToken= b77a5c561934e08 9" version="1" Unrestricted="t rue"/>
=============== =============== =============== =============== =============== = ==== Shel -- This posting is provided "AS IS" with no warranties, and confers no
rights. Use of included script samples are subject to the terms specified at http://www.microsoft.com/info/cpyright.htm
"Jody Gelowitz" <jo**@mail.visu alstatement.com > wrote in message news:%2******** ********@tk2msf tngp13.phx.gbl. .. The code in question is as follows:
With dlgPrintSetting s
If Not (.ShowDialog() = DialogResult.Ca ncel) Then
Try
TextBox1.Append Text("Printing ..." & ControlChars.Cr Lf)
.Document.Print ()
TextBox1.Append Text("Print Successful")
Catch ex As Exception
Debug.WriteLine (ex.ToString)
'MsgBox(ex.ToSt ring)
End Try
End If
End With The security exception is thrown within the following line:
If Not (.ShowDialog() = DialogResult.Ca ncel) Then
after you click the PRINT button. The line below it never gets called:
TextBox1.Append Text("Printing ..." & ControlChars.Cr Lf) Thanks, Jody
"Ken Tucker [MVP]" <vb***@bellsout h.net> wrote in message news:ur******** ******@TK2MSFTN GP09.phx.gbl... Jody,
I can not access your sample code. Could you please post a
link to or email me your code.
Ken ---------------- "Jody Gelowitz" <jo**@mail.visu alstatement.com > wrote in message news:uz******** ******@TK2MSFTN GP09.phx.gbl... >I am trying to find the definition of "Safe Printing" and cannot find out > exactly what this entitles. The reason is that I am trying to print > contents from a single textbox to no avail using the PrintDialog control > under a security setting with only SafePrinting allowed. > > I have attached a sample project that I am using to try to
accomplish > this. > The print dialog appears, but when I press the Print button, I get
an > exception (at the end of this message). Any ideas how I can make
this > work? > > Thanks, > Jody > > > System.Security .SecurityExcept ion: Request for the permission of
type > System.Drawing. Printing.Printi ngPermission, System.Drawing, > Version=1.0.500 0.0, Culture=neutral , PublicKeyToken= b03f5f7f11d50a3 a > failed. > at
System.Security .CodeAccessSecu rityEngine.Chec kHelper(Permiss ionSet > grantedSet, PermissionSet deniedSet, CodeAccessPermi ssion demand, > PermissionToken permToken) > at System.Security .CodeAccessSecu rityEngine.Chec k(PermissionTok en > permToken, CodeAccessPermi ssion demand, StackCrawlMark& stackMark, Int32 > checkFrames, Int32 unrestrictedOve rride) > at System.Security .CodeAccessSecu rityEngine.Chec k(CodeAccessPer mission > cap, StackCrawlMark& stackMark) > at System.Security .CodeAccessPerm ission.Demand() > at System.Drawing. Printing.Printe rSettings.SetHd evmode(IntPtr hdevmode) > at System.Windows. Forms.PrintDial og.UpdatePrinte rSettings(PRINT DLG data, > PrinterSettings settings, PageSettings pageSettings) > at System.Windows. Forms.PrintDial og.RunDialog(In tPtr hwndOwner) > at System.Windows. Forms.CommonDia log.ShowDialog( ) > at PrintTest.Form1 .Button1_Click( Object sender, EventArgs e) > at System.Windows. Forms.Control.O nClick(EventArg s e) > at System.Windows. Forms.Button.On Click(EventArgs e) > at System.Windows. Forms.Button.On MouseUp(MouseEv entArgs mevent) > at System.Windows. Forms.Control.W mMouseUp(Messag e& m, MouseButtons > button, Int32 clicks) > at System.Windows. Forms.Control.W ndProc(Message& m) > at System.Windows. Forms.ButtonBas e.WndProc(Messa ge& m) > at System.Windows. Forms.Button.Wn dProc(Message& m) > at System.Windows. Forms.ControlNa tiveWindow.OnMe ssage(Message& m) > at System.Windows. Forms.ControlNa tiveWindow.WndP roc(Message& m) > at System.Windows. Forms.NativeWin dow.Callback(In tPtr hWnd, Int32 msg, > IntPtr wparam, IntPtr lparam) > > > ************** Loaded Assemblies ************** > mscorlib > Assembly Version: 1.0.5000.0 > Win32 Version: 1.1.4322.573 > CodeBase: > file:///c:/windows/microsoft.net/framework/v1.1.4322/mscorlib.dll > ---------------------------------------- > System.Drawing > Assembly Version: 1.0.5000.0 > Win32 Version: 1.1.4322.573 > CodeBase: >
file:///c:/windows/assembly/gac/system.drawing/1.0.5000.0__b03 f5f7f11d50a3a/system.drawing. dll > ---------------------------------------- > System > Assembly Version: 1.0.5000.0 > Win32 Version: 1.1.4322.573 > CodeBase: >
file:///c:/windows/assembly/gac/system/1.0.5000.0__b77 a5c561934e089/system.dll > ---------------------------------------- > RegexAssembly4_ 0 > Assembly Version: 0.0.0.0 > Win32 Version: n/a > CodeBase: > ---------------------------------------- > IEExecRemote > Assembly Version: 1.0.5000.0 > Win32 Version: 1.1.4322.573 > CodeBase: >
file:///c:/windows/assembly/gac/ieexecremote/1.0.5000.0__b03 f5f7f11d50a3a/ieexecremote.dl l > ---------------------------------------- > PrintTest > Assembly Version: 1.0.1468.23656 > Win32 Version: n/a > CodeBase: http://192.168.0.33/VistaNETtest/Testing/PrintTest.EXE > ---------------------------------------- > System.Windows. Forms > Assembly Version: 1.0.5000.0 > Win32 Version: 1.1.4322.573 > CodeBase: >
file:///c:/windows/assembly/gac/system.windows. forms/1.0.5000.0__b77 a5c561934e089/system.windows. forms.dll > ---------------------------------------- > System.Xml > Assembly Version: 1.0.5000.0 > Win32 Version: 1.1.4322.573 > CodeBase: >
file:///c:/windows/assembly/gac/system.xml/1.0.5000.0__b77 a5c561934e089/system.xml.dll > ---------------------------------------- > Microsoft.Visua lBasic > Assembly Version: 7.0.5000.0 > Win32 Version: 7.10.3052.4 > CodeBase: >
file:///c:/windows/assembly/gac/microsoft.visua lbasic/7.0.5000.0__b03 f5f7f11d50a3a/microsoft.visua lbasic.dll > ---------------------------------------- > > ************** JIT Debugging ************** > To enable just in time (JIT) debugging, the config file for this > application or machine (machine.config ) must have the > jitDebugging value set in the system.windows. forms section. > The application must also be compiled with debugging > enabled. > > >
I tried the code that you gave, and here are the results:
Demand - Printing All: False
System.Security .SecurityExcept ion: Request for the permission of type
System.Drawing. Printing.Printi ngPermission, System.Drawing,
Version=1.0.500 0.0, Culture=neutral , PublicKeyToken= b03f5f7f11d50a3 a failed.
at System.Security .CodeAccessSecu rityEngine.Chec kHelper(Permiss ionSet
grantedSet, PermissionSet deniedSet, CodeAccessPermi ssion demand,
PermissionToken permToken)
at System.Security .CodeAccessSecu rityEngine.Chec k(PermissionTok en
permToken, CodeAccessPermi ssion demand, StackCrawlMark& stackMark, Int32
checkFrames, Int32 unrestrictedOve rride)
at System.Security .CodeAccessSecu rityEngine.Chec k(CodeAccessPer mission
cap, StackCrawlMark& stackMark)
at System.Security .CodeAccessPerm ission.Demand()
at PrintTest.Form1 .Button1_Click( Object sender, EventArgs e) in
C:\Projects\Wor kArea\PrintTest \Form1.vb:line 102
Demand - Printing Default: False
System.Security .SecurityExcept ion: Request for the permission of type
System.Drawing. Printing.Printi ngPermission, System.Drawing,
Version=1.0.500 0.0, Culture=neutral , PublicKeyToken= b03f5f7f11d50a3 a failed.
at System.Security .CodeAccessSecu rityEngine.Chec kHelper(Permiss ionSet
grantedSet, PermissionSet deniedSet, CodeAccessPermi ssion demand,
PermissionToken permToken)
at System.Security .CodeAccessSecu rityEngine.Chec k(PermissionTok en
permToken, CodeAccessPermi ssion demand, StackCrawlMark& stackMark, Int32
checkFrames, Int32 unrestrictedOve rride)
at System.Security .CodeAccessSecu rityEngine.Chec k(CodeAccessPer mission
cap, StackCrawlMark& stackMark)
at System.Security .CodeAccessPerm ission.Demand()
at PrintTest.Form1 .Button1_Click( Object sender, EventArgs e) in
C:\Projects\Wor kArea\PrintTest \Form1.vb:line 109
Demand - Printing Safe: True
Thanks,
Jody
"Ken Tucker [MVP]" <vb***@bellsout h.net> wrote in message
news:e7******** ******@TK2MSFTN GP11.phx.gbl... Hi,
Try this code. Do you get any errors ?
'Check to see if we have printing rights
Dim Allperm As Security.IPermi ssion = New
Drawing.Printin g.PrintingPermi ssion(Drawing.P rinting.Printin gPermissionLeve l
..AllPrinting) Dim Defaultperm As Security.IPermi ssion = New
Drawing.Printin g.PrintingPermi ssion(Drawing.P rinting.Printin gPermissionLeve l
..DefaultPrinti ng) Dim Safeperm As Security.IPermi ssion = New
Drawing.Printin g.PrintingPermi ssion(Drawing.P rinting.Printin gPermissionLeve l
..SafePrinting) Try
Allperm.Demand( )
Defaultperm.Dem and()
Safeperm.Demand ()
Catch ex As Exception
MessageBox.Show (ex.ToString)
End Try Ken ---------------------- "Jody Gelowitz" <jo**@mail.visu alstatement.com > wrote in message news:%2******** ********@tk2msf tngp13.phx.gbl. .. The code in question is as follows:
With dlgPrintSetting s
If Not (.ShowDialog() = DialogResult.Ca ncel) Then
Try
TextBox1.Append Text("Printing ..." & ControlChars.Cr Lf)
.Document.Print ()
TextBox1.Append Text("Print Successful")
Catch ex As Exception
Debug.WriteLine (ex.ToString)
'MsgBox(ex.ToSt ring)
End Try
End If
End With The security exception is thrown within the following line:
If Not (.ShowDialog() = DialogResult.Ca ncel) Then
after you click the PRINT button. The line below it never gets called:
TextBox1.Append Text("Printing ..." & ControlChars.Cr Lf) Thanks, Jody
"Ken Tucker [MVP]" <vb***@bellsout h.net> wrote in message news:ur******** ******@TK2MSFTN GP09.phx.gbl... Jody,
I can not access your sample code. Could you please post a
link to or email me your code.
Ken ---------------- "Jody Gelowitz" <jo**@mail.visu alstatement.com > wrote in message news:uz******** ******@TK2MSFTN GP09.phx.gbl... >I am trying to find the definition of "Safe Printing" and cannot find >out > exactly what this entitles. The reason is that I am trying to print > contents from a single textbox to no avail using the PrintDialog > control > under a security setting with only SafePrinting allowed. > > I have attached a sample project that I am using to try to accomplish > this. > The print dialog appears, but when I press the Print button, I get an > exception (at the end of this message). Any ideas how I can make
this > work? > > Thanks, > Jody > > > System.Security .SecurityExcept ion: Request for the permission of type > System.Drawing. Printing.Printi ngPermission, System.Drawing, > Version=1.0.500 0.0, Culture=neutral , PublicKeyToken= b03f5f7f11d50a3 a > failed. > at
System.Security .CodeAccessSecu rityEngine.Chec kHelper(Permiss ionSet > grantedSet, PermissionSet deniedSet, CodeAccessPermi ssion demand, > PermissionToken permToken) > at System.Security .CodeAccessSecu rityEngine.Chec k(PermissionTok en > permToken, CodeAccessPermi ssion demand, StackCrawlMark& stackMark, > Int32 > checkFrames, Int32 unrestrictedOve rride) > at > System.Security .CodeAccessSecu rityEngine.Chec k(CodeAccessPer mission > cap, StackCrawlMark& stackMark) > at System.Security .CodeAccessPerm ission.Demand() > at System.Drawing. Printing.Printe rSettings.SetHd evmode(IntPtr hdevmode) > at System.Windows. Forms.PrintDial og.UpdatePrinte rSettings(PRINT DLG data, > PrinterSettings settings, PageSettings pageSettings) > at System.Windows. Forms.PrintDial og.RunDialog(In tPtr hwndOwner) > at System.Windows. Forms.CommonDia log.ShowDialog( ) > at PrintTest.Form1 .Button1_Click( Object sender, EventArgs e) > at System.Windows. Forms.Control.O nClick(EventArg s e) > at System.Windows. Forms.Button.On Click(EventArgs e) > at System.Windows. Forms.Button.On MouseUp(MouseEv entArgs mevent) > at System.Windows. Forms.Control.W mMouseUp(Messag e& m, MouseButtons > button, Int32 clicks) > at System.Windows. Forms.Control.W ndProc(Message& m) > at System.Windows. Forms.ButtonBas e.WndProc(Messa ge& m) > at System.Windows. Forms.Button.Wn dProc(Message& m) > at System.Windows. Forms.ControlNa tiveWindow.OnMe ssage(Message& m) > at System.Windows. Forms.ControlNa tiveWindow.WndP roc(Message& m) > at System.Windows. Forms.NativeWin dow.Callback(In tPtr hWnd, Int32
msg, > IntPtr wparam, IntPtr lparam) > > > ************** Loaded Assemblies ************** > mscorlib > Assembly Version: 1.0.5000.0 > Win32 Version: 1.1.4322.573 > CodeBase: > file:///c:/windows/microsoft.net/framework/v1.1.4322/mscorlib.dll > ---------------------------------------- > System.Drawing > Assembly Version: 1.0.5000.0 > Win32 Version: 1.1.4322.573 > CodeBase: >
file:///c:/windows/assembly/gac/system.drawing/1.0.5000.0__b03 f5f7f11d50a3a/system.drawing. dll > ---------------------------------------- > System > Assembly Version: 1.0.5000.0 > Win32 Version: 1.1.4322.573 > CodeBase: >
file:///c:/windows/assembly/gac/system/1.0.5000.0__b77 a5c561934e089/system.dll > ---------------------------------------- > RegexAssembly4_ 0 > Assembly Version: 0.0.0.0 > Win32 Version: n/a > CodeBase: > ---------------------------------------- > IEExecRemote > Assembly Version: 1.0.5000.0 > Win32 Version: 1.1.4322.573 > CodeBase: >
file:///c:/windows/assembly/gac/ieexecremote/1.0.5000.0__b03 f5f7f11d50a3a/ieexecremote.dl l > ---------------------------------------- > PrintTest > Assembly Version: 1.0.1468.23656 > Win32 Version: n/a > CodeBase: http://192.168.0.33/VistaNETtest/Testing/PrintTest.EXE > ---------------------------------------- > System.Windows. Forms > Assembly Version: 1.0.5000.0 > Win32 Version: 1.1.4322.573 > CodeBase: >
file:///c:/windows/assembly/gac/system.windows. forms/1.0.5000.0__b77 a5c561934e089/system.windows. forms.dll > ---------------------------------------- > System.Xml > Assembly Version: 1.0.5000.0 > Win32 Version: 1.1.4322.573 > CodeBase: >
file:///c:/windows/assembly/gac/system.xml/1.0.5000.0__b77 a5c561934e089/system.xml.dll > ---------------------------------------- > Microsoft.Visua lBasic > Assembly Version: 7.0.5000.0 > Win32 Version: 7.10.3052.4 > CodeBase: >
file:///c:/windows/assembly/gac/microsoft.visua lbasic/7.0.5000.0__b03 f5f7f11d50a3a/microsoft.visua lbasic.dll > ---------------------------------------- > > ************** JIT Debugging ************** > To enable just in time (JIT) debugging, the config file for this > application or machine (machine.config ) must have the > jitDebugging value set in the system.windows. forms section. > The application must also be compiled with debugging > enabled. > > >
The only way I can get an Internet permission set equivalent to work is to
up the printing permissions to all. Doesn't work with safe.
--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at http://www.microsoft.com/info/cpyright.htm
"Jody Gelowitz" <jo**@mail.visu alstatement.com > wrote in message
news:%2******** ********@TK2MSF TNGP11.phx.gbl. .. I am still having difficulty in getting this to work. I have attached an updated sample project with what I am trying to accomplish.
The project will be run over the Internet Zone with the default security settings which have limited UIPermissions and SafePrinting. The
permissions that I have enforced on the project are listed below this message. One change that I had to do was to move the UIPermission from Minimal to Optional in order for the application to run over the Internet Zone.
If somebody is able to get printing working with the permissions I have described, could you please provide some sample code as to how it was
done? I am not sure if I am just missing something small or if I am completely off-base with this. Having the print dialog is not a requirement for this if it violates the default security settings for the Internet Zone.
Permissions on the Assembly: ------------------------------ minimal permission set: <PermissionSe t class="System.S ecurity.Permiss ionSet" version="1"> <IPermission class="System.S ecurity.Permiss ions.SecurityPe rmission, mscorlib, Version=1.0.500 0.0, Culture=neutral , PublicKeyToken= b77a5c561934e08 9" version="1" Flags="Executio n"/> <IPermission class="System.D rawing.Printing .PrintingPermis sion, System.Drawing, Version=1.0.500 0.0, Culture=neutral , PublicKeyToken= b03f5f7f11d50a3 a" version="1" Level="SafePrin ting"/> </PermissionSet>
optional permission set: <PermissionSe t class="System.S ecurity.Permiss ionSet" version="1"> <IPermission class="System.S ecurity.Permiss ions.UIPermissi on, mscorlib, Version=1.0.500 0.0, Culture=neutral , PublicKeyToken= b77a5c561934e08 9" version="1" Unrestricted="t rue"/> </PermissionSet>
refused permission set: Not specified
"Shel Blauman [MSFT]" <sh******@onlin e.microsoft.com > wrote in message news:OB******** *****@TK2MSFTNG P11.phx.gbl... Let me admend this, you'll also need safe printing. Just to display the dialog box you're going to need unrestricted UIPermission, then to
perform the printing you'll need the safe printing permission. Was able to run your app to completion with safe printing permission. You may not need all
the other permissions I came up with, you might try experimenting.
Shel
-- This posting is provided "AS IS" with no warranties, and confers no rights. Use of included script samples are subject to the terms specified at http://www.microsoft.com/info/cpyright.htm
"Shel Blauman [MSFT]" <sh******@onlin e.microsoft.com > wrote in message news:e2******** **********@TK2M SFTNGP10.phx.gb l... Here's the permission requirements I get when I check your
application: <IPermission class="System.S ecurity.Permiss ions.Environmen tPermission, mscorlib, Version=1.0.500 0.0, Culture=neutral , PublicKeyToken= b77a5c561934e08 9" version="1" Unrestricted="t rue"/> <IPermission class="System.S ecurity.Permiss ions.FileIOPerm ission, mscorlib, Version=1.0.500 0.0, Culture=neutral , PublicKeyToken= b77a5c561934e08 9" version="1" Unrestricted="t rue"/> <IPermission class="System.S ecurity.Permiss ions.SecurityPe rmission, mscorlib, Version=1.0.500 0.0, Culture=neutral , PublicKeyToken= b77a5c561934e08 9" version="1" Flags="Unmanage dCode, ControlEvidence "/> <IPermission class="System.S ecurity.Permiss ions.UIPermissi on,
mscorlib, Version=1.0.500 0.0, Culture=neutral , PublicKeyToken= b77a5c561934e08 9" version="1" Unrestricted="t rue"/> <IPermission class="System.N et.WebPermissio n, System, Version=1.0.500 0.0, Culture=neutral , PublicKeyToken= b77a5c561934e08 9" version="1" Unrestricted="t rue"/>
=============== =============== =============== =============== =============== = ==== Shel -- This posting is provided "AS IS" with no warranties, and confers no rights. Use of included script samples are subject to the terms specified at http://www.microsoft.com/info/cpyright.htm
"Jody Gelowitz" <jo**@mail.visu alstatement.com > wrote in message news:%2******** ********@tk2msf tngp13.phx.gbl. .. > The code in question is as follows: > > With dlgPrintSetting s > > If Not (.ShowDialog() = DialogResult.Ca ncel) Then > > Try > > TextBox1.Append Text("Printing ..." & ControlChars.Cr Lf) > > .Document.Print () > > TextBox1.Append Text("Print Successful") > > Catch ex As Exception > > Debug.WriteLine (ex.ToString) > > 'MsgBox(ex.ToSt ring) > > End Try > > End If > > End With > > > > The security exception is thrown within the following line: > > If Not (.ShowDialog() = DialogResult.Ca ncel) Then > > after you click the PRINT button. The line below it never gets
called: > > TextBox1.Append Text("Printing ..." & ControlChars.Cr Lf) > > > > Thanks, > Jody > > "Ken Tucker [MVP]" <vb***@bellsout h.net> wrote in message > news:ur******** ******@TK2MSFTN GP09.phx.gbl... > > Jody, > > > > I can not access your sample code. Could you please post
a link > to > > or email me your code. > > > > Ken > > ---------------- > > "Jody Gelowitz" <jo**@mail.visu alstatement.com > wrote in message > > news:uz******** ******@TK2MSFTN GP09.phx.gbl... > > >I am trying to find the definition of "Safe Printing" and cannot find out > > > exactly what this entitles. The reason is that I am trying to print > > > contents from a single textbox to no avail using the PrintDialog control > > > under a security setting with only SafePrinting allowed. > > > > > > I have attached a sample project that I am using to try to accomplish > > > this. > > > The print dialog appears, but when I press the Print button, I
get an > > > exception (at the end of this message). Any ideas how I can
make this > > > work? > > > > > > Thanks, > > > Jody > > > > > > > > > System.Security .SecurityExcept ion: Request for the permission of type > > > System.Drawing. Printing.Printi ngPermission, System.Drawing, > > > Version=1.0.500 0.0, Culture=neutral , PublicKeyToken= b03f5f7f11d50a3 a > > > failed. > > > at System.Security .CodeAccessSecu rityEngine.Chec kHelper(Permiss ionSet > > > grantedSet, PermissionSet deniedSet, CodeAccessPermi ssion
demand, > > > PermissionToken permToken) > > > at
System.Security .CodeAccessSecu rityEngine.Chec k(PermissionTok en > > > permToken, CodeAccessPermi ssion demand, StackCrawlMark&
stackMark, Int32 > > > checkFrames, Int32 unrestrictedOve rride) > > > at System.Security .CodeAccessSecu rityEngine.Chec k(CodeAccessPer mission > > > cap, StackCrawlMark& stackMark) > > > at System.Security .CodeAccessPerm ission.Demand() > > > at System.Drawing. Printing.Printe rSettings.SetHd evmode(IntPtr > hdevmode) > > > at System.Windows. Forms.PrintDial og.UpdatePrinte rSettings(PRINT DLG > data, > > > PrinterSettings settings, PageSettings pageSettings) > > > at System.Windows. Forms.PrintDial og.RunDialog(In tPtr
hwndOwner) > > > at System.Windows. Forms.CommonDia log.ShowDialog( ) > > > at PrintTest.Form1 .Button1_Click( Object sender, EventArgs e) > > > at System.Windows. Forms.Control.O nClick(EventArg s e) > > > at System.Windows. Forms.Button.On Click(EventArgs e) > > > at System.Windows. Forms.Button.On MouseUp(MouseEv entArgs
mevent) > > > at System.Windows. Forms.Control.W mMouseUp(Messag e& m, MouseButtons > > > button, Int32 clicks) > > > at System.Windows. Forms.Control.W ndProc(Message& m) > > > at System.Windows. Forms.ButtonBas e.WndProc(Messa ge& m) > > > at System.Windows. Forms.Button.Wn dProc(Message& m) > > > at System.Windows. Forms.ControlNa tiveWindow.OnMe ssage(Message& m) > > > at System.Windows. Forms.ControlNa tiveWindow.WndP roc(Message&
m) > > > at System.Windows. Forms.NativeWin dow.Callback(In tPtr hWnd,
Int32 msg, > > > IntPtr wparam, IntPtr lparam) > > > > > > > > > ************** Loaded Assemblies ************** > > > mscorlib > > > Assembly Version: 1.0.5000.0 > > > Win32 Version: 1.1.4322.573 > > > CodeBase: > > >
file:///c:/windows/microsoft.net/framework/v1.1.4322/mscorlib.dll > > > ---------------------------------------- > > > System.Drawing > > > Assembly Version: 1.0.5000.0 > > > Win32 Version: 1.1.4322.573 > > > CodeBase: > > > >
file:///c:/windows/assembly/gac/system.drawing/1.0.5000.0__b03 f5f7f11d50a3a/system.drawing. dll > > > ---------------------------------------- > > > System > > > Assembly Version: 1.0.5000.0 > > > Win32 Version: 1.1.4322.573 > > > CodeBase: > > > >
file:///c:/windows/assembly/gac/system/1.0.5000.0__b77 a5c561934e089/system.dll > > > ---------------------------------------- > > > RegexAssembly4_ 0 > > > Assembly Version: 0.0.0.0 > > > Win32 Version: n/a > > > CodeBase: > > > ---------------------------------------- > > > IEExecRemote > > > Assembly Version: 1.0.5000.0 > > > Win32 Version: 1.1.4322.573 > > > CodeBase: > > > >
file:///c:/windows/assembly/gac/ieexecremote/1.0.5000.0__b03 f5f7f11d50a3a/ieexecremote.dl l > > > ---------------------------------------- > > > PrintTest > > > Assembly Version: 1.0.1468.23656 > > > Win32 Version: n/a > > > CodeBase: http://192.168.0.33/VistaNETtest/Testing/PrintTest.EXE > > > ---------------------------------------- > > > System.Windows. Forms > > > Assembly Version: 1.0.5000.0 > > > Win32 Version: 1.1.4322.573 > > > CodeBase: > > > >
file:///c:/windows/assembly/gac/system.windows. forms/1.0.5000.0__b77 a5c561934e089/system.windows. forms.dll > > > ---------------------------------------- > > > System.Xml > > > Assembly Version: 1.0.5000.0 > > > Win32 Version: 1.1.4322.573 > > > CodeBase: > > > >
file:///c:/windows/assembly/gac/system.xml/1.0.5000.0__b77 a5c561934e089/system.xml.dll > > > ---------------------------------------- > > > Microsoft.Visua lBasic > > > Assembly Version: 7.0.5000.0 > > > Win32 Version: 7.10.3052.4 > > > CodeBase: > > > >
file:///c:/windows/assembly/gac/microsoft.visua lbasic/7.0.5000.0__b03 f5f7f11d50a3a/microsoft.visua lbasic.dll > > > ---------------------------------------- > > > > > > ************** JIT Debugging ************** > > > To enable just in time (JIT) debugging, the config file for this > > > application or machine (machine.config ) must have the > > > jitDebugging value set in the system.windows. forms section. > > > The application must also be compiled with debugging > > > enabled. > > > > > > > > > > > > > > >
According to the documentation, the Internet Zone allows for Safe Printing.
Exactly what is "Safe Printing"? Is the documentation incorrect? Or am I
interpreting this incorrectly in assuming that I should be able to send
information to the printer with SafePrinting set?
With my sample application, I set the PrintingPermiss ion to AllPrinting from
SafePrinting which worked if run locally, but still does not work when run
through the Internet Zone (launched from a web server). Adjusting the
permissions on the Internet Zone itself to allow for AllPrinting vs
SafePrinting is not an option for us.
Is printing even possible from a "No Touch Deployment" appliction run over
the web with the default settings for the Internet Zone (which has
SafePrinting and not AllPrinting)? If so, is there documentation or sample
code that I can run to see how this is done?
Thanks,
Jody
"Shel Blauman [MSFT]" <sh******@onlin e.microsoft.com > wrote in message
news:ek******** ******@TK2MSFTN GP09.phx.gbl... The only way I can get an Internet permission set equivalent to work is to up the printing permissions to all. Doesn't work with safe. -- This posting is provided "AS IS" with no warranties, and confers no
rights. Use of included script samples are subject to the terms specified at http://www.microsoft.com/info/cpyright.htm
"Jody Gelowitz" <jo**@mail.visu alstatement.com > wrote in message news:%2******** ********@TK2MSF TNGP11.phx.gbl. .. I am still having difficulty in getting this to work. I have attached
an updated sample project with what I am trying to accomplish.
The project will be run over the Internet Zone with the default security settings which have limited UIPermissions and SafePrinting. The permissions that I have enforced on the project are listed below this message. One change that I had to do was to move the UIPermission from Minimal to Optional in order for the application to run over the Internet Zone.
If somebody is able to get printing working with the permissions I have described, could you please provide some sample code as to how it was done? I am not sure if I am just missing something small or if I am completely off-base with this. Having the print dialog is not a requirement for
this if it violates the default security settings for the Internet Zone.
Permissions on the Assembly: ------------------------------ minimal permission set: <PermissionSe t class="System.S ecurity.Permiss ionSet" version="1"> <IPermission class="System.S ecurity.Permiss ions.SecurityPe rmission, mscorlib, Version=1.0.500 0.0, Culture=neutral , PublicKeyToken= b77a5c561934e08 9" version="1" Flags="Executio n"/> <IPermission class="System.D rawing.Printing .PrintingPermis sion, System.Drawing, Version=1.0.500 0.0, Culture=neutral , PublicKeyToken= b03f5f7f11d50a3 a" version="1" Level="SafePrin ting"/> </PermissionSet>
optional permission set: <PermissionSe t class="System.S ecurity.Permiss ionSet" version="1"> <IPermission class="System.S ecurity.Permiss ions.UIPermissi on,
mscorlib, Version=1.0.500 0.0, Culture=neutral , PublicKeyToken= b77a5c561934e08 9" version="1" Unrestricted="t rue"/> </PermissionSet>
refused permission set: Not specified
"Shel Blauman [MSFT]" <sh******@onlin e.microsoft.com > wrote in message news:OB******** *****@TK2MSFTNG P11.phx.gbl... Let me admend this, you'll also need safe printing. Just to display
the dialog box you're going to need unrestricted UIPermission, then to perform the printing you'll need the safe printing permission. Was able to
run your app to completion with safe printing permission. You may not need all the other permissions I came up with, you might try experimenting.
Shel
-- This posting is provided "AS IS" with no warranties, and confers no rights. Use of included script samples are subject to the terms specified at http://www.microsoft.com/info/cpyright.htm
"Shel Blauman [MSFT]" <sh******@onlin e.microsoft.com > wrote in message news:e2******** **********@TK2M SFTNGP10.phx.gb l... > Here's the permission requirements I get when I check your application: > > <IPermission
class="System.S ecurity.Permiss ions.Environmen tPermission, > mscorlib, Version=1.0.500 0.0, Culture=neutral , > PublicKeyToken= b77a5c561934e08 9" > version="1" > Unrestricted="t rue"/> > <IPermission class="System.S ecurity.Permiss ions.FileIOPerm ission, mscorlib, > Version=1.0.500 0.0, Culture=neutral ,
PublicKeyToken= b77a5c561934e08 9" > version="1" > Unrestricted="t rue"/> > <IPermission class="System.S ecurity.Permiss ions.SecurityPe rmission, > mscorlib, Version=1.0.500 0.0, Culture=neutral , > PublicKeyToken= b77a5c561934e08 9" > version="1" > Flags="Unmanage dCode, ControlEvidence "/> > <IPermission class="System.S ecurity.Permiss ions.UIPermissi on, mscorlib, > Version=1.0.500 0.0, Culture=neutral ,
PublicKeyToken= b77a5c561934e08 9" > version="1" > Unrestricted="t rue"/> > <IPermission class="System.N et.WebPermissio n, System, Version=1.0.500 0.0, > Culture=neutral , PublicKeyToken= b77a5c561934e08 9" > version="1" > Unrestricted="t rue"/> > >
=============== =============== =============== =============== =============== = > ==== > Shel > -- > This posting is provided "AS IS" with no warranties, and confers no rights. > Use of included script samples are subject to the terms specified at > http://www.microsoft.com/info/cpyright.htm > > > "Jody Gelowitz" <jo**@mail.visu alstatement.com > wrote in message > news:%2******** ********@tk2msf tngp13.phx.gbl. .. > > The code in question is as follows: > > > > With dlgPrintSetting s > > > > If Not (.ShowDialog() = DialogResult.Ca ncel) Then > > > > Try > > > > TextBox1.Append Text("Printing ..." & ControlChars.Cr Lf) > > > > .Document.Print () > > > > TextBox1.Append Text("Print Successful") > > > > Catch ex As Exception > > > > Debug.WriteLine (ex.ToString) > > > > 'MsgBox(ex.ToSt ring) > > > > End Try > > > > End If > > > > End With > > > > > > > > The security exception is thrown within the following line: > > > > If Not (.ShowDialog() = DialogResult.Ca ncel) Then > > > > after you click the PRINT button. The line below it never gets called: > > > > TextBox1.Append Text("Printing ..." & ControlChars.Cr Lf) > > > > > > > > Thanks, > > Jody > > > > "Ken Tucker [MVP]" <vb***@bellsout h.net> wrote in message > > news:ur******** ******@TK2MSFTN GP09.phx.gbl... > > > Jody, > > > > > > I can not access your sample code. Could you please
post a link > > to > > > or email me your code. > > > > > > Ken > > > ---------------- > > > "Jody Gelowitz" <jo**@mail.visu alstatement.com > wrote in message > > > news:uz******** ******@TK2MSFTN GP09.phx.gbl... > > > >I am trying to find the definition of "Safe Printing" and
cannot find > out > > > > exactly what this entitles. The reason is that I am trying to print > > > > contents from a single textbox to no avail using the
PrintDialog > control > > > > under a security setting with only SafePrinting allowed. > > > > > > > > I have attached a sample project that I am using to try to accomplish > > > > this. > > > > The print dialog appears, but when I press the Print button, I
get an > > > > exception (at the end of this message). Any ideas how I can make this > > > > work? > > > > > > > > Thanks, > > > > Jody > > > > > > > > > > > > System.Security .SecurityExcept ion: Request for the permission
of type > > > > System.Drawing. Printing.Printi ngPermission, System.Drawing, > > > > Version=1.0.500 0.0, Culture=neutral ,
PublicKeyToken= b03f5f7f11d50a3 a > > > > failed. > > > > at > System.Security .CodeAccessSecu rityEngine.Chec kHelper(Permiss ionSet > > > > grantedSet, PermissionSet deniedSet, CodeAccessPermi ssion demand, > > > > PermissionToken permToken) > > > > at System.Security .CodeAccessSecu rityEngine.Chec k(PermissionTok en > > > > permToken, CodeAccessPermi ssion demand, StackCrawlMark& stackMark, > Int32 > > > > checkFrames, Int32 unrestrictedOve rride) > > > > at > System.Security .CodeAccessSecu rityEngine.Chec k(CodeAccessPer mission > > > > cap, StackCrawlMark& stackMark) > > > > at System.Security .CodeAccessPerm ission.Demand() > > > > at
System.Drawing. Printing.Printe rSettings.SetHd evmode(IntPtr > > hdevmode) > > > > at System.Windows. Forms.PrintDial og.UpdatePrinte rSettings(PRINT DLG > > data, > > > > PrinterSettings settings, PageSettings pageSettings) > > > > at System.Windows. Forms.PrintDial og.RunDialog(In tPtr hwndOwner) > > > > at System.Windows. Forms.CommonDia log.ShowDialog( ) > > > > at PrintTest.Form1 .Button1_Click( Object sender, EventArgs e) > > > > at System.Windows. Forms.Control.O nClick(EventArg s e) > > > > at System.Windows. Forms.Button.On Click(EventArgs e) > > > > at System.Windows. Forms.Button.On MouseUp(MouseEv entArgs mevent) > > > > at System.Windows. Forms.Control.W mMouseUp(Messag e& m, MouseButtons > > > > button, Int32 clicks) > > > > at System.Windows. Forms.Control.W ndProc(Message& m) > > > > at System.Windows. Forms.ButtonBas e.WndProc(Messa ge& m) > > > > at System.Windows. Forms.Button.Wn dProc(Message& m) > > > > at
System.Windows. Forms.ControlNa tiveWindow.OnMe ssage(Message& m) > > > > at System.Windows. Forms.ControlNa tiveWindow.WndP roc(Message& m) > > > > at System.Windows. Forms.NativeWin dow.Callback(In tPtr hWnd, Int32 > msg, > > > > IntPtr wparam, IntPtr lparam) > > > > > > > > > > > > ************** Loaded Assemblies ************** > > > > mscorlib > > > > Assembly Version: 1.0.5000.0 > > > > Win32 Version: 1.1.4322.573 > > > > CodeBase: > > > > file:///c:/windows/microsoft.net/framework/v1.1.4322/mscorlib.dll > > > > ---------------------------------------- > > > > System.Drawing > > > > Assembly Version: 1.0.5000.0 > > > > Win32 Version: 1.1.4322.573 > > > > CodeBase: > > > > > > >
file:///c:/windows/assembly/gac/system.drawing/1.0.5000.0__b03 f5f7f11d50a3a/system.drawing. dll > > > > ---------------------------------------- > > > > System > > > > Assembly Version: 1.0.5000.0 > > > > Win32 Version: 1.1.4322.573 > > > > CodeBase: > > > > > > >
file:///c:/windows/assembly/gac/system/1.0.5000.0__b77 a5c561934e089/system.dll > > > > ---------------------------------------- > > > > RegexAssembly4_ 0 > > > > Assembly Version: 0.0.0.0 > > > > Win32 Version: n/a > > > > CodeBase: > > > > ---------------------------------------- > > > > IEExecRemote > > > > Assembly Version: 1.0.5000.0 > > > > Win32 Version: 1.1.4322.573 > > > > CodeBase: > > > > > > >
file:///c:/windows/assembly/gac/ieexecremote/1.0.5000.0__b03 f5f7f11d50a3a/ieexecremote.dl l > > > > ---------------------------------------- > > > > PrintTest > > > > Assembly Version: 1.0.1468.23656 > > > > Win32 Version: n/a > > > > CodeBase: http://192.168.0.33/VistaNETtest/Testing/PrintTest.EXE > > > > ---------------------------------------- > > > > System.Windows. Forms > > > > Assembly Version: 1.0.5000.0 > > > > Win32 Version: 1.1.4322.573 > > > > CodeBase: > > > > > > >
file:///c:/windows/assembly/gac/system.windows. forms/1.0.5000.0__b77 a5c561934e089/system.windows. forms.dll > > > > ---------------------------------------- > > > > System.Xml > > > > Assembly Version: 1.0.5000.0 > > > > Win32 Version: 1.1.4322.573 > > > > CodeBase: > > > > > > >
file:///c:/windows/assembly/gac/system.xml/1.0.5000.0__b77 a5c561934e089/system.xml.dll > > > > ---------------------------------------- > > > > Microsoft.Visua lBasic > > > > Assembly Version: 7.0.5000.0 > > > > Win32 Version: 7.10.3052.4 > > > > CodeBase: > > > > > > >
file:///c:/windows/assembly/gac/microsoft.visua lbasic/7.0.5000.0__b03 f5f7f11d50a3a/microsoft.visua lbasic.dll > > > > ---------------------------------------- > > > > > > > > ************** JIT Debugging ************** > > > > To enable just in time (JIT) debugging, the config file for
this > > > > application or machine (machine.config ) must have the > > > > jitDebugging value set in the system.windows. forms section. > > > > The application must also be compiled with debugging > > > > enabled. > > > > > > > > > > > > > > > > > > > > > > > >
You'll notice a "send comments on this topic" at the bottom of the page for
PrintDocument.P rint (the one that states safe printing is the required
permission). I clicked on that and sent in a comment about safe printing
not working. Should get to the writer and should result in a bug being
filed unless you and I are missing something. You could do the same if you
would like to hear back directly. I've checked for bugs and don't see any
filed for this.
Shel
--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at http://www.microsoft.com/info/cpyright.htm
"Jody Gelowitz" <jo**@mail.visu alstatement.com > wrote in message
news:eV******** ******@TK2MSFTN GP11.phx.gbl... According to the documentation, the Internet Zone allows for Safe
Printing. Exactly what is "Safe Printing"? Is the documentation incorrect? Or am I interpreting this incorrectly in assuming that I should be able to send information to the printer with SafePrinting set?
With my sample application, I set the PrintingPermiss ion to AllPrinting
from SafePrinting which worked if run locally, but still does not work when run through the Internet Zone (launched from a web server). Adjusting the permissions on the Internet Zone itself to allow for AllPrinting vs SafePrinting is not an option for us.
Is printing even possible from a "No Touch Deployment" appliction run over the web with the default settings for the Internet Zone (which has SafePrinting and not AllPrinting)? If so, is there documentation or
sample code that I can run to see how this is done?
Thanks, Jody
"Shel Blauman [MSFT]" <sh******@onlin e.microsoft.com > wrote in message news:ek******** ******@TK2MSFTN GP09.phx.gbl... The only way I can get an Internet permission set equivalent to work is
to up the printing permissions to all. Doesn't work with safe. -- This posting is provided "AS IS" with no warranties, and confers no rights. Use of included script samples are subject to the terms specified at http://www.microsoft.com/info/cpyright.htm
"Jody Gelowitz" <jo**@mail.visu alstatement.com > wrote in message news:%2******** ********@TK2MSF TNGP11.phx.gbl. .. I am still having difficulty in getting this to work. I have attached an updated sample project with what I am trying to accomplish.
The project will be run over the Internet Zone with the default
security settings which have limited UIPermissions and SafePrinting. The permissions that I have enforced on the project are listed below this message.
One change that I had to do was to move the UIPermission from Minimal to Optional in order for the application to run over the Internet Zone.
If somebody is able to get printing working with the permissions I
have described, could you please provide some sample code as to how it was done? I am not sure if I am just missing something small or if I am
completely off-base with this. Having the print dialog is not a requirement for this if it violates the default security settings for the Internet Zone.
Permissions on the Assembly: ------------------------------ minimal permission set: <PermissionSe t class="System.S ecurity.Permiss ionSet" version="1"> <IPermission class="System.S ecurity.Permiss ions.SecurityPe rmission, mscorlib, Version=1.0.500 0.0, Culture=neutral , PublicKeyToken= b77a5c561934e08 9" version="1" Flags="Executio n"/> <IPermission class="System.D rawing.Printing .PrintingPermis sion, System.Drawing, Version=1.0.500 0.0, Culture=neutral , PublicKeyToken= b03f5f7f11d50a3 a" version="1" Level="SafePrin ting"/> </PermissionSet>
optional permission set: <PermissionSe t class="System.S ecurity.Permiss ionSet" version="1"> <IPermission class="System.S ecurity.Permiss ions.UIPermissi on, mscorlib, Version=1.0.500 0.0, Culture=neutral , PublicKeyToken= b77a5c561934e08 9" version="1" Unrestricted="t rue"/> </PermissionSet>
refused permission set: Not specified
"Shel Blauman [MSFT]" <sh******@onlin e.microsoft.com > wrote in message news:OB******** *****@TK2MSFTNG P11.phx.gbl... > Let me admend this, you'll also need safe printing. Just to display the > dialog box you're going to need unrestricted UIPermission, then to perform > the printing you'll need the safe printing permission. Was able to run your > app to completion with safe printing permission. You may not need
all the > other permissions I came up with, you might try experimenting. > > Shel > > -- > This posting is provided "AS IS" with no warranties, and confers no rights. > Use of included script samples are subject to the terms specified at > http://www.microsoft.com/info/cpyright.htm > > > "Shel Blauman [MSFT]" <sh******@onlin e.microsoft.com > wrote in
message > news:e2******** **********@TK2M SFTNGP10.phx.gb l... > > Here's the permission requirements I get when I check your application: > > > > <IPermission class="System.S ecurity.Permiss ions.Environmen tPermission, > > mscorlib, Version=1.0.500 0.0, Culture=neutral , > > PublicKeyToken= b77a5c561934e08 9" > > version="1" > > Unrestricted="t rue"/> > > <IPermission class="System.S ecurity.Permiss ions.FileIOPerm ission, > mscorlib, > > Version=1.0.500 0.0, Culture=neutral , PublicKeyToken= b77a5c561934e08 9" > > version="1" > > Unrestricted="t rue"/> > > <IPermission
class="System.S ecurity.Permiss ions.SecurityPe rmission, > > mscorlib, Version=1.0.500 0.0, Culture=neutral , > > PublicKeyToken= b77a5c561934e08 9" > > version="1" > > Flags="Unmanage dCode, ControlEvidence "/> > > <IPermission class="System.S ecurity.Permiss ions.UIPermissi on, mscorlib, > > Version=1.0.500 0.0, Culture=neutral , PublicKeyToken= b77a5c561934e08 9" > > version="1" > > Unrestricted="t rue"/> > > <IPermission class="System.N et.WebPermissio n, System, Version=1.0.500 0.0, > > Culture=neutral , PublicKeyToken= b77a5c561934e08 9" > > version="1" > > Unrestricted="t rue"/> > > > > >
=============== =============== =============== =============== =============== = > > ==== > > Shel > > -- > > This posting is provided "AS IS" with no warranties, and confers
no > rights. > > Use of included script samples are subject to the terms specified
at > > http://www.microsoft.com/info/cpyright.htm > > > > > > "Jody Gelowitz" <jo**@mail.visu alstatement.com > wrote in message > > news:%2******** ********@tk2msf tngp13.phx.gbl. .. > > > The code in question is as follows: > > > > > > With dlgPrintSetting s > > > > > > If Not (.ShowDialog() = DialogResult.Ca ncel) Then > > > > > > Try > > > > > > TextBox1.Append Text("Printing ..." & ControlChars.Cr Lf) > > > > > > .Document.Print () > > > > > > TextBox1.Append Text("Print Successful") > > > > > > Catch ex As Exception > > > > > > Debug.WriteLine (ex.ToString) > > > > > > 'MsgBox(ex.ToSt ring) > > > > > > End Try > > > > > > End If > > > > > > End With > > > > > > > > > > > > The security exception is thrown within the following line: > > > > > > If Not (.ShowDialog() = DialogResult.Ca ncel) Then > > > > > > after you click the PRINT button. The line below it never gets called: > > > > > > TextBox1.Append Text("Printing ..." & ControlChars.Cr Lf) > > > > > > > > > > > > Thanks, > > > Jody > > > > > > "Ken Tucker [MVP]" <vb***@bellsout h.net> wrote in message > > > news:ur******** ******@TK2MSFTN GP09.phx.gbl... > > > > Jody, > > > > > > > > I can not access your sample code. Could you please post a > link > > > to > > > > or email me your code. > > > > > > > > Ken > > > > ---------------- > > > > "Jody Gelowitz" <jo**@mail.visu alstatement.com > wrote in
message > > > > news:uz******** ******@TK2MSFTN GP09.phx.gbl... > > > > >I am trying to find the definition of "Safe Printing" and cannot find > > out > > > > > exactly what this entitles. The reason is that I am trying
to print > > > > > contents from a single textbox to no avail using the PrintDialog > > control > > > > > under a security setting with only SafePrinting allowed. > > > > > > > > > > I have attached a sample project that I am using to try to > accomplish > > > > > this. > > > > > The print dialog appears, but when I press the Print button,
I get > an > > > > > exception (at the end of this message). Any ideas how I can make > this > > > > > work? > > > > > > > > > > Thanks, > > > > > Jody > > > > > > > > > > > > > > > System.Security .SecurityExcept ion: Request for the
permission of > type > > > > > System.Drawing. Printing.Printi ngPermission, System.Drawing, > > > > > Version=1.0.500 0.0, Culture=neutral , PublicKeyToken= b03f5f7f11d50a3 a > > > > > failed. > > > > > at > > System.Security .CodeAccessSecu rityEngine.Chec kHelper(Permiss ionSet > > > > > grantedSet, PermissionSet deniedSet, CodeAccessPermi ssion demand, > > > > > PermissionToken permToken) > > > > > at System.Security .CodeAccessSecu rityEngine.Chec k(PermissionTok en > > > > > permToken, CodeAccessPermi ssion demand, StackCrawlMark& stackMark, > > Int32 > > > > > checkFrames, Int32 unrestrictedOve rride) > > > > > at > >
System.Security .CodeAccessSecu rityEngine.Chec k(CodeAccessPer mission > > > > > cap, StackCrawlMark& stackMark) > > > > > at System.Security .CodeAccessPerm ission.Demand() > > > > > at System.Drawing. Printing.Printe rSettings.SetHd evmode(IntPtr > > > hdevmode) > > > > > at System.Windows. Forms.PrintDial og.UpdatePrinte rSettings(PRINT DLG > > > data, > > > > > PrinterSettings settings, PageSettings pageSettings) > > > > > at System.Windows. Forms.PrintDial og.RunDialog(In tPtr
hwndOwner) > > > > > at System.Windows. Forms.CommonDia log.ShowDialog( ) > > > > > at PrintTest.Form1 .Button1_Click( Object sender, EventArgs
e) > > > > > at System.Windows. Forms.Control.O nClick(EventArg s e) > > > > > at System.Windows. Forms.Button.On Click(EventArgs e) > > > > > at System.Windows. Forms.Button.On MouseUp(MouseEv entArgs mevent) > > > > > at System.Windows. Forms.Control.W mMouseUp(Messag e& m, MouseButtons > > > > > button, Int32 clicks) > > > > > at System.Windows. Forms.Control.W ndProc(Message& m) > > > > > at System.Windows. Forms.ButtonBas e.WndProc(Messa ge& m) > > > > > at System.Windows. Forms.Button.Wn dProc(Message& m) > > > > > at System.Windows. Forms.ControlNa tiveWindow.OnMe ssage(Message& m) > > > > > at
System.Windows. Forms.ControlNa tiveWindow.WndP roc(Message& m) > > > > > at System.Windows. Forms.NativeWin dow.Callback(In tPtr hWnd, Int32 > > msg, > > > > > IntPtr wparam, IntPtr lparam) > > > > > > > > > > > > > > > ************** Loaded Assemblies ************** > > > > > mscorlib > > > > > Assembly Version: 1.0.5000.0 > > > > > Win32 Version: 1.1.4322.573 > > > > > CodeBase: > > > > > file:///c:/windows/microsoft.net/framework/v1.1.4322/mscorlib.dll > > > > > ---------------------------------------- > > > > > System.Drawing > > > > > Assembly Version: 1.0.5000.0 > > > > > Win32 Version: 1.1.4322.573 > > > > > CodeBase: > > > > > > > > > > >
file:///c:/windows/assembly/gac/system.drawing/1.0.5000.0__b03 f5f7f11d50a3a/system.drawing. dll > > > > > ---------------------------------------- > > > > > System > > > > > Assembly Version: 1.0.5000.0 > > > > > Win32 Version: 1.1.4322.573 > > > > > CodeBase: > > > > > > > > > > >
file:///c:/windows/assembly/gac/system/1.0.5000.0__b77 a5c561934e089/system.dll > > > > > ---------------------------------------- > > > > > RegexAssembly4_ 0 > > > > > Assembly Version: 0.0.0.0 > > > > > Win32 Version: n/a > > > > > CodeBase: > > > > > ---------------------------------------- > > > > > IEExecRemote > > > > > Assembly Version: 1.0.5000.0 > > > > > Win32 Version: 1.1.4322.573 > > > > > CodeBase: > > > > > > > > > > >
file:///c:/windows/assembly/gac/ieexecremote/1.0.5000.0__b03 f5f7f11d50a3a/ieexecremote.dl l > > > > > ---------------------------------------- > > > > > PrintTest > > > > > Assembly Version: 1.0.1468.23656 > > > > > Win32 Version: n/a > > > > > CodeBase: http://192.168.0.33/VistaNETtest/Testing/PrintTest.EXE > > > > > ---------------------------------------- > > > > > System.Windows. Forms > > > > > Assembly Version: 1.0.5000.0 > > > > > Win32 Version: 1.1.4322.573 > > > > > CodeBase: > > > > > > > > > > >
file:///c:/windows/assembly/gac/system.windows. forms/1.0.5000.0__b77 a5c561934e089/system.windows. forms.dll > > > > > ---------------------------------------- > > > > > System.Xml > > > > > Assembly Version: 1.0.5000.0 > > > > > Win32 Version: 1.1.4322.573 > > > > > CodeBase: > > > > > > > > > > >
file:///c:/windows/assembly/gac/system.xml/1.0.5000.0__b77 a5c561934e089/system.xml.dll > > > > > ---------------------------------------- > > > > > Microsoft.Visua lBasic > > > > > Assembly Version: 7.0.5000.0 > > > > > Win32 Version: 7.10.3052.4 > > > > > CodeBase: > > > > > > > > > > >
file:///c:/windows/assembly/gac/microsoft.visua lbasic/7.0.5000.0__b03 f5f7f11d50a3a/microsoft.visua lbasic.dll > > > > > ---------------------------------------- > > > > > > > > > > ************** JIT Debugging ************** > > > > > To enable just in time (JIT) debugging, the config file for this > > > > > application or machine (machine.config ) must have the > > > > > jitDebugging value set in the system.windows. forms section. > > > > > The application must also be compiled with debugging > > > > > enabled. > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Jody Gelowitz |
last post by:
I was just wondering if anybody has been able to figure out how to get Safe
Printing working over an Internet Zone.
Based on what was mentioned from the previous thread titled "Safe Printing",
it was decided that this was a bug and that Safe Printing does not work. I
just need to verify that these findings are correct.
Thanks,
Jody
|
by: Jody Gelowitz |
last post by:
I am trying to find the definition of "Safe Printing" and cannot find out
exactly what this entitles. The reason is that I am trying to print
contents from a single textbox to no avail using the PrintDialog control
under a security setting with only SafePrinting allowed.
I have attached a sample project that I am using to try to accomplish this.
The print dialog appears, but when I press the Print button, I get an
exception (at the end...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |