我在我的应用程序中使用 SQL 会话状态,但是鉴于我们已经有多个连接字符串,如果所有连接字符串都保存在<connectionStrings>
.
我的问题是,是否有可能以某种方式在配置中指定现有的连接字符串sessionState
?
<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>