all groups > sql server reporting services > july 2005 >
You're in the

sql server reporting services

group:

FileIOPermission


FileIOPermission Siwy
7/22/2005 1:45:22 PM
sql server reporting services:
I got my custom assembly working fine until I add writing to a log
file. Then I get a FileIOPermission error.

I have the following code in my policy file:

<PermissionSet
class="NamedPermissionSet"
version="1"
Name="ReportHelperFilePermissionSet"
Description="A special permission set that grants read access to my
currency rates file.">
<IPermission
class="FileIOPermission"
version="1"
All="C:\ReportHelper.log"/>
<IPermission
class="SecurityPermission"
version="1"
Flags="Execution, Assertion"/>
</PermissionSet>

<CodeGroup class="UnionCodeGroup"
version="1"
PermissionSetName="ReportHelperFilePermissionSet"
Name="MyNewCodeGroup"
Description="A special code group for my custom assembly.">
<IMembershipCondition
class="UrlMembershipCondition"
version="1"
Url="D:\Program Files\Microsoft SQL Server\MSSQL\Reporting
Services\ReportServer\bin\ReportHelper.dll"/>
</CodeGroup>
<CodeGroup
class="UnionCodeGroup"
version="1"
PermissionSetName="FullTrust"
Name="AWCLibrary">
<IMembershipCondition
class="UrlMembershipCondition"
version="1"
Url="D:\Program Files\Microsoft SQL Server\MSSQL\Reporting
Services\ReportServer\bin\ReportHelper.dll"/>
</CodeGroup>

I write to my log file as follows:

public static void WriteLogFile(String msg)
{
FileIOPermission perm1 = new
FileIOPermission(FileIOPermissionAccess.Write, @"C:\ReportHelper.log");
perm1.Assert();
//try
//{
FileStream fs = new FileStream(@"C:\ReportHelper.log",
FileMode.OpenOrCreate, FileAccess.ReadWrite);
StreamWriter w = new StreamWriter(fs);
w.BaseStream.Seek(0, SeekOrigin.End);
w.Write("{0} {1} ", DateTime.Now.ToLongTimeString(),
DateTime.Now.ToLongDateString());
w.Write(msg + "\r\n");
w.Flush();

w.Close();
}

What am I missing here? Any help would be appreciated.

Thanks!
Re: FileIOPermission BALAJI via SQLMonster.com
7/25/2005 12:00:00 AM

Check this
http://www.c-sharpcorner.com/Code/2005/June/CustomAssemblyinRS.asp

HTH
If still you face the issue, let me know (bkkrishnan [at] hotmail [dot] com)

Thanks
Balaji


[quoted text, click to view]


--
Message posted via SQLMonster.com
Re: FileIOPermission Siwy
7/25/2005 9:15:53 AM
Hi Balaji,

I followed the article and it still doesn't work. I added [assembly:
AllowPartiallyTrustedCallers] to my assembly and removed extra
PermissionSet and CodeGroup sections from my policy file (I left the
"FullTrust" one) and I still get FileIOPermission error.

Thanks,

Kris

[quoted text, click to view]
AddThis Social Bookmark Button