Monday, December 23, 2013

asp.net - Disable ASP.NET_sessionId

In one of the applications I developed we did not want to store any cookies for legal issues.Hence we had to disable all the cookies.While testing the application on the test servers I noticed the following Asp.Net_sessionId cookie being set.

More about it here on msdn (http://msdn.microsoft.com/en-us/library/ms178194.ASPX)

We still didn't want to use it even though it was non persistent since we were not allowed to create any cookies.One workaround is to disable the session state on IIS for the site.

Note:You will not be able to use Session if you do this.


 




Thursday, December 12, 2013

SqlDependency must be called for each server that is being executed

Recently we rewrote our web applications in VS 2012 and .Net 4.0 and hosted it on IIS 7.For caching content I used the Sql Dependency and SQL service Service Broker.On test environment with load balancing we had two servers configured and everything was working as expected.


However when I moved the applications to production I started getting this error.







The only difference was the connectionstring which specified a failover server.

<add name="CONTENTDSN" connectionString="Data Source=Server1;Failover Partner=Server2;Initial Catalog=Database_Name;uid=UserId;pwd=password;"/>

The error was due to the failover server not having the database objects.Now when you use SQL dependency make sure that the failover server i.e Server2, has all the necessary database objects as the main server i.e. Server1.