1
<add name="SqlState" connectionString="Data Source=localhost;DataBase=AnyNameOfServerState;Integrated Security=True" providerName="System.Data.SqlClient"/>
<sessionState mode="SQLServer" sqlConnectionString="SqlState" allowCustomSqlDatabase="true" cookieless="false" timeout="20"/>
我试图把上述两行到我的web.config文件,然后运行该代码: 我得到这个:问题设置会话sql模式?
System.Data.SqlClient.SqlException:
MSDN给了我下面的提示:
确认您正在使用有效凭证进行连接。
Make sure that the credentials you are supplying are valid. For more information, see How to: Access SQL Server Using Predetermined Credentials.
验证服务器名称是否正确,并且服务器正在运行。
Make sure that you are using the correct server name, and that the server can be reached.
但我不知道该怎样跟随他们,因为那是我第一次在SQL模式下使用会话,想法...
更多注:我需要暂时几秒钟的会话,我需要保存我所拥有的动态控件的状态。我认为我可能遇到的状态模式的问题是,如果它拖动用户20分钟,减慢我的应用程序。我应该使用viewState吗?
我不知道这是如何完成的,Aristos :( – Matrix001
@ Matrix001找到你创建的数据库文件,你可以这样做吗?,然后右键单击该文件,属性,然后安全,然后添加aspnet用户,并给他读写权限。 – Aristos