It’s with some satisfaction that I’m able to fill this one under the “solved” section. I’m currently building a Reporting Services solution which generates price lists which includes images of products along with some other information. My dataset includes a column with a path for the image of a particular product, but I can’t be sure that the image actually exists in the file system which means that a call to System.IO.File.Exists is needed. Thus my trouble begins: The methods always returns false even though the file is accessible…. Hours of head scratching ensues until I find that Reporting Services includes its own policy file which doesn’t allow access to the file system.
A quick change to the file Microsoft SQL Server\MSSQL\Reporting Services\ReportServer\rssrvpolicy.config makes all the difference in the world. Initially I gave RS FullTrust just to narrow the potential sources of error to a minimum, but FileIOPermission will suffice in my case. Specifically I changed the following node from
<CodeGroup
class="FirstMatchCodeGroup"
version="1"
PermissionSetName="Nothing">
to
<CodeGroup
class="FirstMatchCodeGroup"
version="1"
PermissionSetName="FullTrust">
Also do remember that we are deailing with XML thus case very muhc matters. "Fulltrust" does not yield the same results as "FullTrust".