Windows Control w/in ASP.NET 2.0 Permissions Problem

C

CJ Taylor

Alright, so my admin and I are trying to get this thing to work...
I'll just lay it out for you, no point in trying to hide what I'm doing.

We are using/switching to Microsoft SQL Reporting Services 2000. For those
of you that use it, you know its a fantastic product. EXCEPT you can't
print on the web. Yes, MS keeps saying "oh yeah...we'll put that in there".
Of course these are the same people that said "Oh yeah. Yukon will be out
in 2003."

So, given I sold my boss on the idea, I now have to create a way to print.
I thought, yeah, we could do it on the server, but you have to do a lot of
B.S. work to make it happen, plus install all the printers on the server,
unless I do some tricks with AD, which I don't really want to do.

So, I develop a Windows Contorl that I want to place in my ASP.NET web form
using the <object> tag. Simple combo box that will call the rendering from
report services.

Good, that works fine, got it working.. except when I try to enumerate
through the InstalledPrinters list on the users computer, I get a
SecurityException

I've tried trusting the assembly. I don't know what I'm doing wrong or
where to look. I thought this was supposed to work fine on the localhost,
however its not. Is there some documetation I can read somewhere that
really explains this?

Thanks,

CJ

This is what I get...

-----------------------------------------------------------------------
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.Security.SecurityException: Request for the permission of type
'System.Drawing.Printing.PrintingPermission, System.Drawing,
Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
failed.
at System.Security.CodeAccessSecurityEngine.Check(PermissionToken
permToken, CodeAccessPermission demand, StackCrawlMark& stackMark, Int32
checkFrames, Int32 unrestrictedOverride)
at System.Security.CodeAccessSecurityEngine.Check(CodeAccessPermission
cap, StackCrawlMark& stackMark)
at System.Security.CodeAccessPermission.Demand()
at System.Drawing.Printing.PrinterSettings.get_InstalledPrinters()
at MSRSReportPrinter.ucSelectPrinter.ucSelectPrinter_Load(Object sender,
EventArgs e)
at System.Windows.Forms.UserControl.OnLoad(EventArgs e)
at System.Windows.Forms.UserControl.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.UserControl.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at
System.Windows.Forms.ActiveXImpl.System.Windows.Forms.IWindowTarget.OnMessag
e(Message& m)
at
System.Windows.Forms.ActiveXImpl.System.Windows.Forms.IWindowTarget.OnMessag
e(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg,
IntPtr wparam, IntPtr lparam)
The action that failed was:
Demand
The type of the first permission that failed was:
System.Drawing.Printing.PrintingPermission
The Zone of the assembly that failed was:
Trusted
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top