I'm using SQL Session State in my app, however given that we have several connection strings already, it would be easier to maintain the config if all the connection strings were held, well, in <connectionStrings>
.
My question is, is it possible somehow to specify an existing connection string in the sessionState
config?
<connectionStrings>
<add name="ConnString1" connectionString="data source=xx;Initial Catalog=zzz;"
providerName="System.Data.SqlClient" />
<add name="EFConnString"
connectionString="metadata=res://*/EF.csdl|res://*/EF.ssdl|res://*/EF.msl;provider=System.Data.SqlClient;provider connection string="data source=xxx;initial catalog=yyy;App=EntityFramework""
providerName="System.Data.EntityClient" />
<add name="SessionStateConn" connectionString="data source=xx;Initial Catalog=zzz;"
providerName="System.Data.SqlClient" />
</connectionStrings>
<system.web>
<sessionState mode="SQLServer"
sqlConnectionString="**SessionStateConn**"
sqlCommandTimeout="30" customProvider="" ... etc
</sessionState>
Anyone coming to this late the MSDN documentations state that for the sqlConnectionString attribute you can specify either the full connection string OR the name of an existing connection string: https://msdn.microsoft.com/en-us/library/h6bb9cz9%28v=vs.85%29.aspx (see sqlConnectionString under Attributes & Elements)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With