Reading the web.config file in SQL Reporting Services
The .NET Framework v2.0 gives us the ability to (easily) read the web.config file of our applications for information like <appSettings> using the System.Configuration and System.Web.Configuration namespaces: This probably isn't news to most of you.
Will this work with Reporting Services? Yes, with a caveat around security. Remember that you'll be writing custom code to do this work...and custom code (whether embedded code behind your report or in an custom assembly) won't have the necessary permissions to run under SSRS unless you first grant them in rssvrpolicy.config.
How do you do this, you ask? See this article:
https://support.microsoft.com/kb/842419
Comments
- Anonymous
November 16, 2006
Do you know how to add your appSettings for your Custom Data Extension when you add a new reference for CDE in ReportingServices (as per your article)?i.e I've my setting to reference to some xml file. I tried to add a new appSetting section under ReportServer's web.config, it killed the whole app. How do I add the reference and where?Thx. - Anonymous
November 21, 2006
The comment has been removed - Anonymous
January 28, 2007
I just configured SQL 2005 reporting services today and I'm running into a problem which I hope you can help:The web.config of my site has the following section: <codeSubDirectories> <add directoryName="VB"></add> <add directoryName="CS"></add> </codeSubDirectories>The site works absolutely fine, except when I try to access Reporting Services by typing http://mySite/Reports.The error I received is: The code subdirectory '/Reports/App_Code/VB/' does not exist.Well, obviously that directory does not exist, because the subdirectory is under my website (D:/MySite/App_Code/VB) and NOT under the vitual report manager directory. So, I'm wondering what I need to do to overcome this error.Thanks for your help! - Anonymous
May 06, 2014
HI If you are using Reporting Service 2008 then I can say you can use this by Steps to get Reporting Service Configuration file as below steps : Go to Reports Properties window Open Reference Tab Click Add Button to add assembly Then select System.Configuration, And Then use the Appsetting Values or any configuration values like below System.Configuration.ConfigurationManager.AppSettings("ConnectionString") Best Regard Rs