如何删除sessionState sqlConnectionString重复

时间:2012-11-27 04:16:43

标签: asp.net

我在web.config的标准connectionStrings元素中有一组连接字符串

web.config中的sessionState元素规定在使用sql会话状态时使用sqlConnectionString属性。

这通常导致连接字符串在文件中的2个位置重复,如果有人忘记更改这两个位置,可能会导致它们不同步。

我可以使用哪种机制来删除此重复内容?

示例配置:

<connectionStrings>
    <add name="IWouldLikeToUseThisConnectionStringForSessionState" value="..."
</connectionStrings>

<sessionState 
    mode="SQLServer" 
    allowCustomSqlDatabase="true"
    sqlConnectionString="DuplicatedConnectionStringHereAndCanGetOutOfSync"
    />

1 个答案:

答案 0 :(得分:1)

处理此问题的一种方法可能是使用Partioning,如here所述。