Permissions required for a DataSet inside a Control

Hi,

which Permissions do I need when a Control uses internally a typed DataSet? In general I've no problems with User Controls in IE, but I've one that contains a DataSet object and that doesn't get loaded due to a security exception.

Jürgen

[253 byte] By [codefund.com] at [2008-2-17]
# 1
Hmmm, this is a bit confusing.

First, you mentioned IE. Are you talking about an ASP.Net app or Windows Forms?

Second, is your problem with the user control, or are you having a security issue with your database, such as SQL Server, when you are trying to retrieve the data to populate your user control?

Third, if you are talking about ASP.NET you also have a layer of security involved with IIS. Given that, you may want to try the aspalliance list serves for ASP problems.

julie

codefund.com at 2007-9-8 > top of Msdn Tech,Windows Forms,ClickOnce and Setup & Deployment Projects...
# 2
i believe (I may be wrong) that he's referring to embedding WindowsForms into a web page in IE. If that's the case, make sure your application has System.Data.SqlClient.SqlClientPermission on the client.
codefund.com at 2007-9-8 > top of Msdn Tech,Windows Forms,ClickOnce and Setup & Deployment Projects...
# 3
Yes, you're right. I've a WinForms control embedded in a Web Page. Why should a DataSet require SqlClient Permission? I'm using the DataSet internally and create DataTable objects as a result of mathematical calculations and bind those tables then to a DataGrid to visualize the result of the calculations. No Sql in there and my understanding of DataSet is that it's purpose is to be independent from a data provider (that's why we have DataAdapter).

Jürgen

codefund.com at 2007-9-8 > top of Msdn Tech,Windows Forms,ClickOnce and Setup & Deployment Projects...
# 4
hhhhmmm...yes, you're right...i just assumed you were pulling data. i don't know why actually, sorry! maybe you should look into the other Permissions and see if there's one related to DataSets, but I'm not quite sure why there would be. Sorry I'm not much help, maybe someone else has a better idea.
codefund.com at 2007-9-8 > top of Msdn Tech,Windows Forms,ClickOnce and Setup & Deployment Projects...
# 5
Have you confirmed that it is indeed the DataSet that is causing your security exception? Can you load the control without a DataSet?

thanks
- mike

codefund.com at 2007-9-8 > top of Msdn Tech,Windows Forms,ClickOnce and Setup & Deployment Projects...
# 6
Of course. As soon as I comment out any reference to the DataSet the control loads. My suspicion is that it has to do with advanced usage of serialization and/or reflection in the DataSet implementation. I tried to setup a PermissionSet that allows more Reflection use than the default Intranet or Internet PermissionSets, but that doesn't help. There must be more. And up to now I didn't find a way for IE hosted controls to figure out which security setting was violated. It would be nice if IE had a ".NET console" just like a Java console for the JavaVM and use this console for diagnostic output.

Jürgen

codefund.com at 2007-9-8 > top of Msdn Tech,Windows Forms,ClickOnce and Setup & Deployment Projects...
# 7
This might help you out...

http://support.microsoft.com/default.aspx?scid=kb%3Ben-us%3B313892

The first step in diagnosing these problems is to determine the permission being violated....

You might also find the following tool useful for determining the permissions required for an assembly

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cptools/html/cpgrfpermissionsviewtoolpermviewexe.asp

You're only option once you've determined the functionality violating the code access security is to either recode that section or raise permissions for your assembly inside IE. You can do this by changing settings on the client such as adding your site to the list of the intranet zones so your control will run with intranet permissions instead of internet.... or alternatively establishing a specific trust for your assembly.

Look at the .NET Framework Configuration Utility under Runtime Security Policy to see how you can go about giving your control the necessary permissions to run.

Michael

codefund.com at 2007-9-8 > top of Msdn Tech,Windows Forms,ClickOnce and Setup & Deployment Projects...
# 8
Well, I'm fully aware how to set the permissions for my control and I have it already working that way by marking my server as a trusted Web Site and giving it full trust (IntraNet permissions also don't work).

I simply was astonished that the inclusion of a DataSet makes a control virtually unusable for public Web sites. Given the central role of the DataSet class in any control that has to deal with data access this is at least uncomfortable.

Cheers
Jürgen

codefund.com at 2007-9-8 > top of Msdn Tech,Windows Forms,ClickOnce and Setup & Deployment Projects...