Question

How to refresh asp page without loosing data (e.g. submit every 5 secounds)

Asked by: saljas

If an ASP file1 is submitted it's data is transfared to the other ASP file2 so they can be requested e.g.
Variable = Request("Variable name form ASP file1").  How to auto submit that data in file1 every 10 secound without letting our visitor click a button?
(we are doing an internet Election Survey and people will watch the change online).
Salah Aljasim

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2003-04-29 at 09:55:32ID20600183
Tags

asp

,

refresh

Topic

Miscellaneous Web Development

Participating Experts
5
Points
250
Comments
22

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. copying a sheet from file1 to file2!!!!!!
    hai all, As I have little knowledge about VBA programming can anyone help me out in solving my requirement. I wanted to copy sheet1 from file1 to sheet1 in file2, the cells range is a1:h56 whenever the user tries to save file1. thanking you in advance manju
  2. perl script to print all lines in file2 not found in file1
    Hi, I have two files: file1 and file2 content of file1: joe/1 111 test1 james/2 222 test2 . . content of file2: 12345 aaaaa james/2 33333 gdfgf tomy/4 fdsfs fsfds sue/4 fsfsf sfdsfs joe/1 . . How can I exclude the first e...
  3. automatic file renaming like file1, file2, file3, file4, s…
    hi all! i need to dynamically update file names. all i need is to have a string (file path) updated like file1, file2, file3,, so on. could some one help me!!!!!!!!! thanks in advance.

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: tripst3rPosted on 2003-04-29 at 10:19:59ID: 8421647

I'm not sure that I understand you correctly, but it would seem that you'll have to do this client-side, as the problem rests on the stateless nature of the web itself. Once you flush your response to the requestor, how does your server (your ASP) know what Request to answer? How does it know to which client it should send a Response?

<meta http-equiv="refresh" content="[timeInSeconds]; [pageURI]" />

pageURI can be relative.

You'll also want to use the standard cache-expiring META elements so that when you refresh, you do your best to force the client to get a new version of the page.

My answer assumes that what you want is to show the user a refreshed results page (file2), which could be independent of the user's submitted data, rather than to repeatedly sumbit their input. This latter would, to say the least, skew your results.

 

by: polmintPosted on 2003-04-29 at 10:22:04ID: 8421663

Good Day Mr.Salah

The solution I have to offer works with any programming language because I am giving u a http solution.
Use this line in the Head section of the ASP page you are writing.

<META HTTP-EQUIV="Refresh" CONTENT="10">

This will automatically refreshes the pages ( makes a call to the webserver every 10 secs)

Copy and paste the below code and save it as a HTML page in the server scope. The below page will refresh itself every 2 secs.


<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META HTTP-EQUIV="Refresh" CONTENT="2">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD>

<BODY>
hello sai
</BODY>
</HTML>

 

by: rambo1312Posted on 2003-04-29 at 22:14:17ID: 8425559

hi there,

If you are using a form to submit the data,

Put the same script name in the Action attribute of form
and submit the form using the following javascript code

<Script lang=JavaScript>
<!--

setTimeout("documemnt.YOUR_FORM_NAME.submit()",10000)

-->
</Script>

put this script at the end of the page

hope to hear,
Ramandeep

 

by: dequajaPosted on 2003-04-30 at 04:39:03ID: 8427146

This indeed the correct answer.  Although there is a small error in the spelling.

setTimeout("document.YOUR_FORM_NAME.submit()",10000)

And it should not be but at the end of your html page.

 

by: rambo1312Posted on 2003-04-30 at 06:15:59ID: 8427810

hey dequaja!

tanx for the correction :)

have one query for you though.. why shouldn't this code be at the end of the page?

expect a reply

Bests..
Raman

 

by: dequajaPosted on 2003-04-30 at 06:26:39ID: 8427919

If you put it like this in your code:

<script language="JavaScript">
setTimeout("document.YOUR_FORM_NAME.submit()",10000);
</script>

it can be placed everywhere in your html page, it doesn't matter.

 

by: rambo1312Posted on 2003-04-30 at 06:33:21ID: 8427982

ohk, but if Mr. Salah wants to refresh the page exactly 10 seconds after the page gets loaded, it should be placed in the last. Because any browser will execute the timer as soon as this statement is encountered.

or the best option will be..
<BODY onLoad="javascript:setTimeout('document.YOUR_FORM_NAME.submit()',10000);
" >
this will refresh the page exactly after 10 seconds of the page load

anyways this is upto Mr. Salah whatever way he wants it to be, this script may be placed at any point of the page

have a nice day ahead

Raman.

 

by: rambo1312Posted on 2003-04-30 at 06:35:18ID: 8427999

ohk, but if Mr. Salah wants to refresh the page exactly 10 seconds after the page gets loaded, it should be placed in the last. Because any browser will execute the timer as soon as this statement is encountered.

or the best option will be..
<BODY onLoad="javascript:setTimeout('document.YOUR_FORM_NAME.submit()',10000);
" >
this will refresh the page exactly after 10 seconds of the page load

anyways this is upto Mr. Salah whatever way he wants it to be, this script may be placed at any point of the page

have a nice day ahead

Raman.

 

by: tripst3rPosted on 2003-04-30 at 06:45:22ID: 8428075

Of course, if the user has JS turned off, you won't be able to resubmit the form.

And besides, why would anyone want one user's entry to be repeatedly submitted? If that user responded Yes to a question, the survey would indicate that at least as many people said yes as times that the user's page was refreshed. Not a very accurate survey.

Tk

 

by: polmintPosted on 2003-04-30 at 06:52:51ID: 8428131

Hi,

Client can turn off the Java Script at his end but he cant touch the HTTP headers. The better way is to do the HTTP refresh.

Thanks

 

by: polmintPosted on 2003-04-30 at 07:05:24ID: 8428222

Hi,

Client can turn off the Java Script at his end but he cant touch the HTTP headers. The better way is to do the HTTP refresh.

Thanks

 

by: DevastatedPosted on 2003-04-30 at 16:49:31ID: 8432458

<HEAD>
<META HTTP-EQUIV="Refresh" CONTENT="10;URL=http://www.designer-websites.co.uk">
</HEAD>

should be placed in file 2 - so once file1 info. has been submitted and the info. has been delt with at file2 it will return the user to file 1.

will not solve the problem! (i think)

at file2 you will need to have a timed event occuring every 10 seconds which queries the 'request' object, and deals with the information as desired - thus never leaving file2 once file1 (form) has been submitted. - at least this way - doing it at the server - the information is correct at the time it was sent i.e. every ten seconds, not relying on networks etc, which should be included in your timing (more so than in 'mine') calculations.

look at

response.write timer

here is an example that shows how to use the timer object taken from:-
http://www.4guysfromrolla.com/webtech/122799-1.shtml

Dim Iterations, StartTime, ElapsedTime, AverageTimePerIteration, X

Iterations = 1000
StartTime = Timer

For X = 1 TO Iterations
   '... do operations to be timed
Next

ElapsedTime = Timer - StartTime
AverageTimePerIteration = ElapsedTime / Iterations




 

by: DevastatedPosted on 2003-04-30 at 16:52:05ID: 8432476

about the not letting them click a button...

why on earth not ? - you trying to take over thier browser ?!?!?!?

you should ideally place this code in an 'included' page, within other pages - so it wont matter if the user presses the back button - are you worrying about windows built in features that can store form info ? - not sure if that 'addon' can be stopped - its a client program that probably has zero interaction with any server coding.

 

by: rambo1312Posted on 2003-04-30 at 22:38:01ID: 8433653

HELLooo everyone..

hey are we all giving our own opinions, If Mr. Salah has some need, we must give them Expert Solutions and not Opinions.

And just by refreshing the page by using META tags or using the Timer object will not submit any data.

And how many of us have the JS option ticked off in the browser settings, who would do this. JS is the DeFacto language for client side scripting. Ohk we being experts know this issue, but why would any novice do this. He wouldn't even know about JS and putting it off for security issues.

Anyways.. we have given our solutions but where Mr. Salah?
Mr. Salah if you could explain you situation better.. am sure you will be flooded with better solutions from all the experts roaring here

 

by: tripst3rPosted on 2003-05-01 at 05:53:41ID: 8435240

The point of mentioning that a user might have JS turned off is that the questioner needs to take that into account. It's poor design to create a webpage that does not handle situations over which the page designer has no control. If the questioner's app already has processes in place to force the use of JS, he can well speak up about that.

"Who would do this" -- anybody who wants to. It's not the programmer's/designer's place to decide that. Maybe the user is using an adaptive browser that doesn't even have JS available. Maybe the user is on a phone or pther portable device that doesn't have it enabled. As for whether a novice would do this, you're assuming that novices are using the questioner's survey. Perhaps it's a survey for web experts. :-)

Using META elements will indeed resubmit data, as will the JS function submit(). That's why the function is "submit". As for the META element, refreshing a page using the browser chrome can resubmit a form, so how is it that reloading the page programmatically will not resubmit the data?

Tk

 

by: rambo1312Posted on 2003-05-01 at 06:17:34ID: 8435388

great reply there by you tripst3r :-)

Well now.. i never knew that by using META tag we can actually also post the FORM Data. This is something new to me. My apologies for that and if it is so then it is the best option available Mr. Salah.

But Mr. Salah.... Hullooo?? where are youuuu?? :-)

one honest question for you tripst3r.. Which Client-Side language do you use for your web pages. pages which would be used by all and anywhere

hope to hear from you

Raman.

 

by: DevastatedPosted on 2003-05-01 at 06:47:28ID: 8435577

did you even read my post, rambo1312 ?

because i hope you are not including me in that brief and oft innacurate summary, which you put directly under my post!

with fear of sounding stupid for repeating myself for those that obviously did not read, THINK, and consider what is being put forward...

>>>at file2 you will need to have a timed event occuring every 10 seconds which queries the 'request' object, and deals with the information as desired - thus never leaving file2 once file1 (form) has been submitted. - at least this way - doing it at the server - the information is correct at the time it was sent i.e. every ten seconds, not relying on networks etc, which should be included in your timing (more so than in 'mine') calculations. etc

And yes using this method you dont need javascript enabled at the browser!

 

by: polmintPosted on 2003-05-01 at 06:49:42ID: 8435596

Hi everyone,

This was the question Mr.Saljas has  posted.

How to refresh asp page without loosing data (e.g.  submit every 5 secounds)

If we carefully observe the first part - He want to refresh ASP page without loosing data.

When u refresh a web page 2 things happen (HTTP protocol)

1. You are requesting the file from the Webserver. Here if the cache is disabled you will get the current version of the page.

2. If you are submiting a form and half way through you have pressed on refresh the Browser prompts that it is going to resubmit the data to the server.

when no other possiblity is there (other than the one mentioned above) where is the question of loosing the data comes from?


In the second part of the question he asks for
(e.g.  submit every 5 secounds)

Means he wants to submit the page every 5 seconds.

Whatever is the programming language or object based language u use, all have to follow HTTP protocol. If u use form.submit or HTTP refresh both does the same job.

It is only a matter of how u do it. I prefer the HTTP way.Because it is more basic in nature (so should be the fastest way to do it). Javascript has to invoke the HTTP header :)

What I understand from the detailed description of his question is that like a stock ticker - its an election ticker. which should refersh automatically. So user is not going to post any data from his end.

But i am suprised that Mr. saljas  is still giving us all a deaf ear.

Its high time Mr.saljas  respond on our answers.

Thanks

 

by: rambo1312Posted on 2003-05-01 at 12:14:10ID: 8437775

My apologies for you too Mr. Devastated..

Actually you are right in saying that i did not read your post.

Had a bad time posting solutions here

Sorry once again..

Raman

 

by: DevastatedPosted on 2003-05-01 at 19:13:49ID: 8440429

Thanks for the apology, and im sorry for being so abrupt.

 

by: DevastatedPosted on 2003-05-01 at 19:21:25ID: 8440565

It sounds like the real problem encountered is with the request object, in that it is 'being cleared' at some point, a solution to this being to use session variables to store the request.

Then again we could all be barking up the wrong tree because the grammar used is so poor, im afraid to say.

 

by: polmintPosted on 2003-05-05 at 11:18:34ID: 8463589

hi saljas,

Where are u? Please respond.

Thanks,

P.S: Help EE to help u better by clearing Accepted Answers

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...