Die-Tech
asked on
Validating existence of image URL in report
I'm trying to validate the existence of an image URL for a report page in SQL Server Reporting Services. The image URL is dynamically created based on an item number. I either display the found image at the URL or a special image that indicates there are is no image for the item. All of the images are on a virtual directory on the same server as the report server.
I've tried specifying the folder path \\servername\... and that does not work (as I would expect). I also tried specifying custom code in the report using a programmatic web request (HttpWebRequest). I expected that, but when I use it I get the following exception:
System.Security.SecurityEx ception: Request for the permission of type 'System.Net.WebPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c56193 4e089' failed.
at System.Security.CodeAccess SecurityEn gine.Check (Object demand, StackCrawlMark& stackMark, Boolean isPermSet)
at System.Security.CodeAccess Permission .Demand()
at System.Net.HttpWebRequest. .ctor(Uri uri, ServicePoint servicePoint)
at System.Net.HttpRequestCrea tor.Create (Uri Uri)
at System.Net.WebRequest.Crea te(Uri requestUri, Boolean useUriBase)
at System.Net.WebRequest.Crea te(String requestUriString)
at ReportExprHostImpl.CustomC odeProxy.U rlExists(S tring u)
The action that failed was:
Demand
The type of the first permission that failed was:
System.Net.WebPermission
The Zone of the assembly that failed was:
MyComputer
This works in Visual Studio but does not work on the report server or another server on the network. I need a method that works to perform this validation or work around it so that the special image is shown if the other image is missing.
I've tried specifying the folder path \\servername\... and that does not work (as I would expect). I also tried specifying custom code in the report using a programmatic web request (HttpWebRequest). I expected that, but when I use it I get the following exception:
System.Security.SecurityEx
at System.Security.CodeAccess
at System.Security.CodeAccess
at System.Net.HttpWebRequest.
at System.Net.HttpRequestCrea
at System.Net.WebRequest.Crea
at System.Net.WebRequest.Crea
at ReportExprHostImpl.CustomC
The action that failed was:
Demand
The type of the first permission that failed was:
System.Net.WebPermission
The Zone of the assembly that failed was:
MyComputer
This works in Visual Studio but does not work on the report server or another server on the network. I need a method that works to perform this validation or work around it so that the special image is shown if the other image is missing.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.