G
Guest
Hi...
I'm trying to implement roles in various components (i.e. using different
sets of configuration depending, in this case, on which environment your in).
Pretty easy to add an AppSettings["role"] variable in most cases.
The thing that's causing me difficulty are the asp:SqlDataSource components
in an aspx page. Depending on the role setting, I have a different
connection string I want to use. Problem is that ConnectionString="<%$ %>"
only lets you have a fixed lookup for one value in one collenction.
It doesn't allow ConnectionString="<% %>". <%#
ConfigurationManager.ConnectionStrings["db"+AppSettings["role"]].ConnectionStrings
%> is called malformed. I defined my on method on the page to do the lookup
and while ConnectionString="<%# GetConnectionString() %>" parses fine, it
doesn't execute.
So I'm obviously missing something here. How would one choose a
connectionstring based on some dynamic element?
Thanks
Mark
I'm trying to implement roles in various components (i.e. using different
sets of configuration depending, in this case, on which environment your in).
Pretty easy to add an AppSettings["role"] variable in most cases.
The thing that's causing me difficulty are the asp:SqlDataSource components
in an aspx page. Depending on the role setting, I have a different
connection string I want to use. Problem is that ConnectionString="<%$ %>"
only lets you have a fixed lookup for one value in one collenction.
It doesn't allow ConnectionString="<% %>". <%#
ConfigurationManager.ConnectionStrings["db"+AppSettings["role"]].ConnectionStrings
%> is called malformed. I defined my on method on the page to do the lookup
and while ConnectionString="<%# GetConnectionString() %>" parses fine, it
doesn't execute.
So I'm obviously missing something here. How would one choose a
connectionstring based on some dynamic element?
Thanks
Mark