session object II

  • Thread starter Thread starter Berkdan
  • Start date Start date
B

Berkdan

hi all,

i want to learn this about session object in asp,
when i connect to the site can session object write my ip adress to the text
file and when i cut the connection then can it write offline to the same
text file? it must write when my dial up connection was cutted.

can i use session or is there anyway? if it is possible please write any
code.

thank you very much.
 
You cannot use the session object to accurately determine if a user is
connected to your site or not.

A session object is create when a user navigate to your site the first
time on a new browser instance. The session object that exist on the
server until the user has been inactive for a specified period of
time. This is a setting on the web server, and is not affected when a
user disconnect from your site.

One approach is to have the user logon and logoff to your website.
This doesn't work all the time because the user could close the
browser without logging off. For that, you could put logic in your
page to call the logoff page in a sub window before the page is
unloaded.

It is difficult to accurately keep track of how many users are
connected to your site because a web server is designed to serve large
amounts of request, so it does not keep a static connection with each
user.

Tommy,
 
Thank you for answer,

i wanna write chat application server using asp.
Clients will use exe file. i wrote server.exe but most of web hosts don't
accept execute exe file.
coz i wanna use asp. how can i do it?

Thank you,
Berkdan
 
This will be a tough one because as I mentioned in my earlier post, a
web server does not hold a static connection with a client. If the
web server cannot push information to a client, the client can pull
information from the web server.

Here is my suggested solution:
Create a web service on the web server that will accept and return
chat
messages.

The client exe will call this web service at a regular interval to
check for
new messages in the data store.

When sending a message, the client exe call this web service, and the
web
service will save the message in a data store.

You can actually do all this in a webpage, and the client won't even
need to run an exe.

The problem with this solution is that web service call is slow
compare to sending raw data directly with TCP/IP. I don't know how
slow it will be. You should do some testing on this. Maybe it is
within an acceptable range. The other problem is that it puts a huge
load on you web server. Each of your clients is going to constantly
make web service calls to pool for new messages.
If this is within the bandwidth supplied by your web hosting company,
then this solution might work if you don't have a lot of clients
running at the same time.

Tommy,
 
Back
Top