开发者

ASP.net Session in SQL or cookie

I deployed an ASP.net web site to two servers and put them behind the load balanced environment. Now that problem is that the performa开发者_StackOverflow中文版nce is really slow. Even for just simple button event, it takes long time to finish the simple button event. However, if I access the site separately (by its server’s address), performance is good. What our system engineer told me was that the application handles session state in process as if it runs on only one server, it could not handle clustering. So, he suggested that I should use the session object in the code to store the session in SQL server, or cookie.

I am currently using session variables to store the session.

I am kind of a new to ASP.net and I am not sure exactly what this mean and how I can accomplish this in my .net code (C#)?

Thanks.


Here is a good link to start you off: ASP.NET Session State

You would probably want to go with the Out of process mode where the servers all access 1 session process on a designated server, if speed is your top priority or SQL Server mode where all servers access 1 database if reliability is your top priority as with out of process mode if the process dies your session data is lost similar to how in-process session handling works.

No coding changes for storing session data would be needed, just the initial configuration of the environment and a web.config change.


First off, you need to configure sessionstate in your web.config for what you want to do. Here is a step by step tutorial on storing sessionstate in sql server. Hope it helps!

http://support.microsoft.com/kb/317604

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜