Sunday, February 19, 2012

custom assembly permissions

I wrote a custom assembly which access a oracle server database (ODBC). The
report failes on the RS Server, not in the Report Designer.
The problem is the database access, without it the assembly works.
I modified RSReportServer.config and rssrvpolicy.config. I read everything
I could find about the subject (spend more then 50 hours). But I'm still poke
around in the fog.
Can somebody instruct me by give me the exact code he is using in the config
files and in the assembly? It seems the code must be modified too, I tried
but it doesn't work.
Thanks in advance!Right now, the .NET Framework provider for ODBC is not yet enabled for
partial trust scenarios. It currently requires FullTrust permissions (this
will change in a future version). So, unless your custom assembly has
FullTrust permissions, it won't work because asserting OdbcPermission has no
effect (details can also be found on MSDN: OdbcPermission class). In the
particular case of using ODBC to connect to Oracle you definitely need to
give the assembly FullTrust permissions and assert them inside the custom
assembly (see code snippet below which asserts the FullTrust permission
inside the custom assembly via an attribute):
[PermissionSet(SecurityAction.Assert, Unrestricted=true)]
public foo()
{
// ...
OdbcConnection cn = new OdbcConnection("..... connection string");
cn.Open();
// ...
}
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Dev Main" <DevMain@.discussions.microsoft.com> wrote in message
news:09D9ED7E-5473-4876-BEFF-47234BCAA4BE@.microsoft.com...
>I wrote a custom assembly which access a oracle server database (ODBC). The
> report failes on the RS Server, not in the Report Designer.
> The problem is the database access, without it the assembly works.
> I modified RSReportServer.config and rssrvpolicy.config. I read
> everything
> I could find about the subject (spend more then 50 hours). But I'm still
> poke
> around in the fog.
> Can somebody instruct me by give me the exact code he is using in the
> config
> files and in the assembly? It seems the code must be modified too, I tried
> but it doesn't work.
> Thanks in advance!

No comments:

Post a Comment