Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / December 2004

Tip: Looking for answers? Try searching our database.

Strange security issue in WinForms application

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
ejstembler - 10 Dec 2004 21:51 GMT
I have this WinForms application which is exhibiting a strange security issue.

The project contains a Form and a UserControl.  The Form has a method which
populates data and an event from the UserControl.  When I call the method
from the UserControl event it raises a SqlPermission exception.  If I call
the method from any other method in the from (such as Form_Load) it works
fine.

I'm assuming the UserControl must have less rights assigned to it, but why?  
It's embedded in the same project as the Form (and also embedded on the Form
itself).  Incidentially, even if I grant the executable "FullTrust" it still
raises the exception from the UserControl event.

Does anyone know what's going on and why?
Ed Kaim - 13 Dec 2004 14:34 GMT
If the user control is in another assembly, that assembly must also have
required permissions to make the call. One option is to give the assembly
permission to make the call in question--or full trust if you're lazy :-)

Alternatively, if you absolutely trust the user control assembly, the
calling EXE (which you've already given full trust to) can Assert
permissions before invoking the call. Check out
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cp
conAssert.asp

for more info on how to do this.

>I have this WinForms application which is exhibiting a strange security
>issue.
[quoted text clipped - 15 lines]
>
> Does anyone know what's going on and why?
ejstembler - 13 Dec 2004 18:49 GMT
What's strange is the UserControl is in the same assembly as the form (exe),
as I mentioned.  FullTrust does not have any affect as I mentioned as well.  
Incidentially, I'm using declartive LinkDemands instead of Asserts.

In any event, I'll figure it out eventually...

> If the user control is in another assembly, that assembly must also have
> required permissions to make the call. One option is to give the assembly
[quoted text clipped - 25 lines]
> >
> > Does anyone know what's going on and why?

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.