473,397 Members | 2,116 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Handle Http Session

My webserver application (a http handler) accepts a sequence of requests
from client. Each request requires an access to database (password/username
supplied in the request). I am looking at improving the performance of the
webserver. My questions:

1. How should I handle the session as the client will post one request after
antoher (for may be consequtively 5 requests) ?

2. Is there any way to 'cache' the database connection and reuse it for
subsequent request from the same client ?

Thanks.
Nov 17 '05 #1
1 3322
> 1. How should I handle the session as the client will post one request
after
antoher (for may be consequtively 5 requests) ?
There are many ways to handle sessions. One way is the Session object,
which is by far the easiest method. You can (if required) store
information about the current session:

Session["MyVar"] = "MyValue";

And retrieve it later like this:

string sMyVar = Convert.ToString( Session["MyVar"] );

Using the session object is slightly less scalable (or slightly more
difficult to port to a server farm.)
2. Is there any way to 'cache' the database connection and reuse it for
subsequent request from the same client ?

It might sound like a good idea to store the database connection in the
Session object, but that's really one of the worst things one can do. The
session object lingers around for 20 minutes after the last HTTP request,
so that would basically swamp your database with connections.

Database connection caching (usally called "pooling") is implemented in
the framework. Connections with different credentials (username/password)
are pooled separately. So in effect, what you are asking for happens
automatically!

Greetings,
Wessel
Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Edward Rothwell | last post by:
I have a web site where once a user has logged on I store their MemberID in a global variable in the global.asa file. Then in other pages I find out which member I am dealing with by looking at...
1
by: Nay | last post by:
Hi When we use forms authentication I set the time and a url for login page after configured amount of time, via web.config. But, what is the best practice to do it after configurable amount of...
4
by: Gaetan | last post by:
I have an ASP.Net 1.1 application using datagrid. I am trying to handle conditions where the users post back an updated datagrid after the session times out. The results are not pretty. Sometimes...
3
by: Bill Nguyen | last post by:
When my app attempts to save a particular file in the same VB session, I got an error message . If I close the app and run again, the file is overwritten ok. I guess I need to close the file...
3
by: Hans Merkl | last post by:
Hi, I am helping to build a web app that's pretty much a wrapper around a web service. The question now is how to store the handle of the web service object between requests. My client is using...
2
by: Max | last post by:
Hi, I am helping to build a web app that's pretty much a wrapper around a web service. The question now is how to store the handle of the web service object between requests. My client is using...
9
by: lli | last post by:
Hi Guys, I am a new cgi programmer. Now I need to design a web application: 1. first, user login by their username and password in a form (login form). When users click submit button it connect...
6
by: somaskarthic | last post by:
Hi This is somas here. I asked query about detecting the browser close event using javascript. I want to detect the event only when the X button in the top right corner is clicked and not else...
2
by: =?Utf-8?B?TWljaGVsIFNjaGF3YW5u?= | last post by:
Hi all, I try to create a service witch handle the session switch events: Lock, unlocked etc... I can do this with a standard executable like this (it's just an example):...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.