I have developed my application in which I'm using crystal reports. When i run the application in my system the crystal reports runs fine. But when i change my trust level to Medium i am getting an error saying: System.Security.Permissions.FileIOPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 I tried using Breakpoints to find out the error it shows the error fileIOPermission on this particular line rd.Load(Server.MapPath("~/CustomerPurchaseBill.rpt"));
Any suggestion would be appreciated.
It's probably because Crystal Reports uses the Windows Temp directory when writing files out (which makes it almost unusable in hosted environments where you can't control those things). I have a post from 2008 where I go into more detail:
http://www.blakepell.com/2008-10-09-crystal-reports-2008-aspnet-iis
The fixes require permissions changes and/or changing the directory Crystal uses via the registry (also something not easily accessible).
Although, your error could also occur because you can't access the report file on the file system. If that is the case you could look at using impersonation for that section of code so it runs under an account that does have permissions to it.
Hope this helps!