Tough ASP question

Results 1 to 3 of 3

Thread: Tough ASP question

  1. #1
    Grootjans Guest

    Default Tough ASP question

    Hello everyone, here&#039s a tough question:<BR><BR>I want to keep a database of all the visitors to my site. They are uniquely identified by name and IP adress. The name has to be specified once and is then kept in a cookie on the users hard drive.<BR><BR>When my page loads, it should read the cookie, identify the users name and using his IP adress, look into the database for extra data (number of visits, time spent on my page ...).<BR><BR>This data has to be loaded into an invisible form. This form is then updated depending on the actions of the user.<BR><BR>When the user then quits or goes to another page, an UPDATE SQL statement should be executed to update the previously read data. <BR><BR>Any tips how this can be done. Read/write to a database is no problem to me. Using forms and hidden text fields is also well known and used. The problem is that I don&#039t know how to combine the data read in a cookie and the IP adress to create an SQL statement with the right parameters.<BR>The second problem is: how do I trigger an UPDATE SQL statement when the user exits my page without the user noticing the difference. He should still be going to the choosen URL.<BR><BR>I realise this is quite a challenge. Can anyone help me

  2. #2
    Jeffrey Guest

    Default RE: Tough ASP question

    Here is a good article about reading cookies:<BR><BR><BR>Get the ip address from server.variables<BR><BR>ipaddr = Request.ServerVariables("REMOTE_ADDR")<BR><BR>Set up your update statement through a stored procedure called on the Session_OnEnd event in your global.asa

  3. #3
    Join Date
    Dec 1969

    Default RE: Tough ASP question

    &#062;&#062;When the user then quits or goes to another page, an UPDATE SQL statement should be executed to update the previously read data. <BR><BR>No can do - there is no way that your server can know that I&#039ve closed my browser (or that my ISP has dropped my connection...) All you can do is use Session_onEnd to watch for their session timing out (which means you need to have sessions enabled).<BR><BR>BTW, unless you are in a very well-controlled intranet environment the user&#039s IP address cannot be used to identify anything - even many intranets are using DHCP to dynamically assign IP addresses these days. Plus there are all sorts of firewalls, proxies and clever routers that hide client IP addresses for security reasons.<BR><BR>Dunc

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts