Results 1 to 4 of 4

Thread: creating db entries in realtime!

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jul 2002
    Posts
    18

    creating db entries in realtime!

    I guess that would be an appropriate subject.

    I'm designing a website using asp.net.

    It's sort of an R&D thing. Anyways, I need to be able to track what page each ip visits, how long that user was on that page, and so to say archive it all. I plan on using a SQL Database.

    I'm very new to Asp.net, and VB.NET. If you have any reccomendations on some books, that might help me out...

    There is alot more to this project then that, but right now I want to establish the database and all that good stuff. So for example user A vists page X for 10min, using an interface I want see how long this user has been on this page, and all the previous pages this user has been on. Each DB entry needs to be unique to the ip address of the user.

    So say I have 10 users on the site, I can click on whatever IP address, and see a list of all the pages the user has been on, what day, what time, etc...

    Like I said though I'm new to alot of this, I have a book on ASP.NET for dummies, I don't like these books. I bought Karl Moore's book, if you have some other reccomendations for books. I'm all ears.

    I don't really think I'll need a book on asp.net, as I know HTML really well, and using VS.NET I can write all my HTML, and write all my vbcode fairly easy and it does the rest.

    Until I get some replies, I'm gonna be setting up a test server, and slap some asp.net webpages. And start messin around with some of the code snippets I have.

    Thanks for your time, and any help you may have to offer.

  2. #2
    Lively Member
    Join Date
    Aug 2002
    Location
    outerspace
    Posts
    126
    youll proablly want to be usint the response object and the onpage load and on page unload events to do this I would imaigne. There are alot of things athat are different using asp.net then asp espically using vs.net. i dont know of any good books persay. I try to use the web when i can if I have a question usually I kind find a solution.
    "All those who wonder are not lost" -j.r.r tolkien

  3. #3
    Fanatic Member Patoooey's Avatar
    Join Date
    Aug 2001
    Location
    New Jersey, USA
    Posts
    774

    Re: creating db entries in realtime!

    Originally posted by Chuki
    There is alot more to this project then that, but right now I want to establish the database and all that good stuff. So for example user A vists page X for 10min, using an interface I want see how long this user has been on this page, and all the previous pages this user has been on. Each DB entry needs to be unique to the ip address of the user.

    So say I have 10 users on the site, I can click on whatever IP address, and see a list of all the pages the user has been on, what day, what time, etc...
    Capturing the client IP and date/time for each page is easy enuf.

    Code:
    string s = HttpContext.Current.Request.ServerVariables["REMOTE_HOST"];
    string s2 = HttpContext.Current.Request.ServerVariables["URL"]; 
    Response.Write("IP = " + s + "<br>");
    Response.Write("Current URL = " + s2 + "<br>");
    Response.Write("Current Date/Time = " + DateTime.Now);
    Getting the time online for each page is going to give you an ulcer.

    A web page is state-less. Meaning there is no direct connection between the server and client once the page has been sent down. A user can download your page, then goto lunch for an hour.....then simply close the browser on return. You *could* capture that event in the Application/Session close events but your times will be less then meaningless. Especially since the app/session close events aren't the most reliable things in the world.

    As far as suggestions for learning....the ASP.NET QuickStart tutorials are where I started.

    http://www.asp.net/tutorials/quickstart.aspx

    John

  4. #4
    Lively Member
    Join Date
    Jul 2002
    Location
    Gateshead, UK
    Posts
    101

    Client scripts to time visit

    What about either just using the onload/unload event handlers, to submit the time of the visit, and when the visitor leaves?

    Or, if that isn't enough for you (dunno why it wouldn't be...), consider using more clientside scripts - my preferred language is Javascript - to find the difference between the page load and exit times, probably using the Date() function, and its methods. Then it would simply be a case of submitting the data through either a HTTP form, an "invisible image", or an IFRAME etc... (using the Querystring, you can send data to a page, without the page itself refreshing/loading.)
    <% Session("OwNeD")=True %><html><body>Blah... <%="Now get your ass back to the twilight zone..."%></body></html>

Posting Permissions

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



Click Here to Expand Forum to Full Width