Why is no error coming while storing session in SQL Server?
I ran InstallSqlState.sql from .Net Framework 4.0 directory in Sql Server. Then I configured Sql session using this:
<sessionState mode="SQLServer" stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString = "data 开发者_高级运维source=localhost; user id=sa; password="
cookieless="false" timeout="20" />
When I store something in Session it works! Even SessionId can be session in Session object. So I became happy because without any error it started working. So to purposefully bring some error I removed this
stateConnectionString = "tcpip=127.0.0.1:42424"
sqlConnectionString = "data source=localhost; user id=sa; password="
Now all it knows is that the mode is SqlServer but no connection string and no username and password. But still it works! How is this possible? How can I know whether my state is configured properly or not? Whatever parameter I give it always works. What is happening here and what should I do if I want to see the contents of a particular user's session in SQL Server.
Your server is localhost, your own machine, which is used as the default server. Also when you specify no userid/password it defaults to using a MS "trusted connection", which again works as you work on your local machine.
To create an error either change the IP-address or the username/password combo.
精彩评论