User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP.NET section within the Web Development category of DaniWeb, a massive community of 456,519 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,806 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP.NET advertiser: Lunarpages ASP Web Hosting
Views: 825 | Replies: 7
Reply
Join Date: Sep 2007
Posts: 81
Reputation: justapimp is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 1
justapimp justapimp is offline Offline
Junior Poster in Training

Help ASP.NET project help

  #1  
Oct 1st, 2007
I have this web page that sends a start real-time tracking command to GPS devices all over. The way the code is currently written fulfills its purpose as long as the page is actively loaded. However, if the user shuts down the browser or the computer, the device does not receive the stop real-time tracking command since the program is not running.

What I would like to accomplish is to create a script or service that will keep track of when a device needs to stop reporting in the event the user forgot to stop the real time tracking. I want to implement this feature for two reasons. First, the constant (non-stop) reporting becomes a billing issue for the company and second the devices are battery operated and the issue of energy consumption plays a big part.

What I was thinking on doing is implementing an AJAX script that will access the web method at the end of a specific interval but I believe this implementation will not work either. I tried to use the setTimeout() method with Ajax and it did not go very well.

I need some help and I would appreciate any input that would put me back on track with this project?

Thank you,
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Sep 2007
Posts: 1,058
Reputation: SheSaidImaPregy is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 61
SheSaidImaPregy SheSaidImaPregy is offline Offline
Veteran Poster

Re: ASP.NET project help

  #2  
Oct 1st, 2007
Have you considered using an Page_Unload method, and then backing it up through javascript on the <body onUnload="stopDevice()"> where stopDevice() is a javascript function?

This way you can have your C# or VB.NET to end your device transmission and a javascript backup just for insurance.

I have never dealt with the situation you are in, so I cannot be very good help, but hopefully I can lead you into a better direction.
Reply With Quote  
Join Date: Sep 2007
Posts: 81
Reputation: justapimp is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 1
justapimp justapimp is offline Offline
Junior Poster in Training

Re: ASP.NET project help

  #3  
Oct 1st, 2007
Thank you for your reply and you definitely gave me some good idea on how to proceed. The question is: would this method also works if the user terminate the session by just closing the browser? I am really new to this javascript stuff but it doesn't appear to be a very difficult language. My real problem is that I don't know enough of it to be able to get things done fast enough.
Reply With Quote  
Join Date: Sep 2007
Posts: 1,058
Reputation: SheSaidImaPregy is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 61
SheSaidImaPregy SheSaidImaPregy is offline Offline
Veteran Poster

Re: ASP.NET project help

  #4  
Oct 1st, 2007
Sure, here's a detailed explanation of what you can use, and what you might have to:

http://www.codeproject.com/useritems...of_Browser.asp

The one problem you will face is that javascript is client based, so if they have it disabled it will not work for them. You MIGHT be able to run the javascript server side since you're using asp.net, but I cannot guarantee that. You can use what you see here for an explanation on what to look for if you plan to write your own private function via VB or C#, or the like. I, personally, like to make sure all sides are covered. I would use the javascript, all functions for all browsers with if statements to determine which browser is which, and use the behind coding to make sure the connection is closed. I don't find a problem adding the extra code as it is only extra insurance, which I believe is necessary.
Reply With Quote  
Join Date: Sep 2007
Posts: 81
Reputation: justapimp is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 1
justapimp justapimp is offline Offline
Junior Poster in Training

Re: ASP.NET project help

  #5  
Oct 1st, 2007
thank you for the link, though I understand some of the code on that page, but most of goes right over my head. For now I think it is safe to program a quick disconnect method in the event a user exited the page in question. later, I can take my time implementing a method that will cover all bases.

Thank you very much for your help.
Reply With Quote  
Join Date: Sep 2007
Posts: 1,058
Reputation: SheSaidImaPregy is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 61
SheSaidImaPregy SheSaidImaPregy is offline Offline
Veteran Poster

Re: ASP.NET project help

  #6  
Oct 1st, 2007
No problem. Do you best to make sure they disconnect from the popular browswers (IE, FireFox, Netscape, Opera, and Safari). Wish I could be more help.
Reply With Quote  
Join Date: May 2006
Location: Bellevue, WA
Posts: 1,548
Reputation: Infarction has a spectacular aura about Infarction has a spectacular aura about Infarction has a spectacular aura about 
Rep Power: 8
Solved Threads: 51
Sponsor
Infarction's Avatar
Infarction Infarction is offline Offline
Battle Programmer

Re: ASP.NET project help

  #7  
Oct 1st, 2007
I think most browsers still execute the page unload event when you close them. You can always try it and see how it goes
Reply With Quote  
Join Date: Sep 2007
Posts: 1,058
Reputation: SheSaidImaPregy is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 61
SheSaidImaPregy SheSaidImaPregy is offline Offline
Veteran Poster

Re: ASP.NET project help

  #8  
Oct 1st, 2007
Originally Posted by Infarction View Post
I think most browsers still execute the page unload event when you close them. You can always try it and see how it goes


Actually, IE responds better to "onBeforeLoad", though it is not an option for other browsers
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb ASP.NET Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the ASP.NET Forum

All times are GMT -4. The time now is 4:05 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC