R
Radu
Hi. In a repeater I have as ItemTemplate the following, among others,
and everything works great:
<asp:SqlDataSource
ID="LocationSqlDataSource"
SelectCommand="SELECT blah-blah-blah"
EnableCaching="True"
ConnectionString="<%$ ConnectionStrings:OrderingProcess %>"
CacheDuration="60"
FilterExpression="ID = {0}" RunAt="server">
<FilterParameters>
<asp:ControlParameter ControlID="HyperLinkMeasureID"
PropertyName="Text" /> </FilterParameters>
</asp:SqlDataSource>
etc.
I have encrypted in Base64 the "OrderingProcess" which was
<add name="OrderingProcess" connectionString="server=xxx
\xxx;database=xxx;User ID=xxx;Password=xxx;"
providerName="System.Data.SqlClient" />
and the "ConnectionString" which was
<add key="ConnectionString" value="Data Source=xxx\xxx;Initial
Catalog=xxx;User ID=xxx;Password=xxx;"/>
and in the code-behind I have a function named DecryptSetting which
can be used as:
DecryptSetting(System.Configuration.ConfigurationManager.AppSettings("OrderingProcess"))
The question is: how could I use this function in
ConnectionString="<%$ ConnectionStrings:OrderingProcess %>"
above ?
I cannot say
ConnectionString="<%=
DecryptSetting(System.Configuration.ConfigurationManager.AppSettings("OrderingProcess"))
%>"
In all the places in code behind where I needed the connection string,
I have used
Cache("ConnectionString") which has been set in App_Init as:
HttpContext.Current.Cache("ConnectionString") =
DecryptSetting(System.Configuration.ConfigurationManager.AppSettings("ConnectionString"))
Thanks a lot for your time and effort.
Alex.
and everything works great:
<asp:SqlDataSource
ID="LocationSqlDataSource"
SelectCommand="SELECT blah-blah-blah"
EnableCaching="True"
ConnectionString="<%$ ConnectionStrings:OrderingProcess %>"
CacheDuration="60"
FilterExpression="ID = {0}" RunAt="server">
<FilterParameters>
<asp:ControlParameter ControlID="HyperLinkMeasureID"
PropertyName="Text" /> </FilterParameters>
</asp:SqlDataSource>
etc.
I have encrypted in Base64 the "OrderingProcess" which was
<add name="OrderingProcess" connectionString="server=xxx
\xxx;database=xxx;User ID=xxx;Password=xxx;"
providerName="System.Data.SqlClient" />
and the "ConnectionString" which was
<add key="ConnectionString" value="Data Source=xxx\xxx;Initial
Catalog=xxx;User ID=xxx;Password=xxx;"/>
and in the code-behind I have a function named DecryptSetting which
can be used as:
DecryptSetting(System.Configuration.ConfigurationManager.AppSettings("OrderingProcess"))
The question is: how could I use this function in
ConnectionString="<%$ ConnectionStrings:OrderingProcess %>"
above ?
I cannot say
ConnectionString="<%=
DecryptSetting(System.Configuration.ConfigurationManager.AppSettings("OrderingProcess"))
%>"
In all the places in code behind where I needed the connection string,
I have used
Cache("ConnectionString") which has been set in App_Init as:
HttpContext.Current.Cache("ConnectionString") =
DecryptSetting(System.Configuration.ConfigurationManager.AppSettings("ConnectionString"))
Thanks a lot for your time and effort.
Alex.