This is a migrated thread and some comments may be shown as answers.

Changing SessionState ConnectionString programmatically

2 Answers 311 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Fred
Top achievements
Rank 1
Fred asked on 31 Jan 2012, 12:07 AM
Hi there,

We're using the SQL Server provider to store Telerik Reports session state in a database.  We have this Section set in the Web.Config file for our C#/ASP.Net web project:

  <Telerik.Reporting>
    <SessionState provider="Database">
      <Providers>
        <Provider name="Database" type="Telerik.Reporting.DatabaseSession.DatabaseSessionProvider, Telerik.Reporting.DatabaseSession, Version=5.3.12.119, Culture=neutral, PublicKeyToken=a9d7983dfcc261be">
          <Parameters>
            <Parameter name="BackendName" value="mssql" />
              <Parameter name="ConnectionString" value="MyConnectionString" />
          </Parameters>
        </Provider>
      </Providers>
    </SessionState>
  </Telerik.Reporting> 


Everything is working fine, except we want to take the " <Parameter name="ConnectionString" value="MyConnectionString" />" out of the Web.Config file and add it, or at least update it, programmatically, in Global.asax, getting the ConnectionString from the AppSettings which is stored in a separate envsettings.config file.  I've found code online showing how to update programmatically the AppSettings section of the web.config file, but not a custom section like "Telerik.Reporting".  Does anyone have anyone sample code that would demonstrate how to do this?

Many thanks,


2 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 03 Feb 2012, 09:27 AM
Hi Fred,

The database session provider is used in the processing stage and even if there was an out of the box way to access the Telerik.Reporting section, there is no right place in the life cycle where you could plug-in to do so.

All the best,
Steve
the Telerik team

Q3’11 of Telerik Reporting is available for download. Register for the What's New in Data Tools webinar to see what's new and get a chance to WIN A FREE LICENSE!

0
Fred
Top achievements
Rank 1
answered on 08 Feb 2012, 04:39 PM
I don't understand your comment about there being no right place in the life-cycle. Surely when application initialization occurs the connection string for the provider could be set to a new value if it were actually exposed.
Tags
General Discussions
Asked by
Fred
Top achievements
Rank 1
Answers by
Steve
Telerik team
Fred
Top achievements
Rank 1
Share this question
or