Solved

Can I temporarily show one html page while some background process(asp program) is running on server side

Posted on 2001-08-23
30
306 Views
Last Modified: 2010-05-18
      First  I  display one HTML page with input fields , where user  enters some  data and  presses submit button , which  in turn  calls an ASP program . This ASP program  processes data submitted  by user While it may take several seconds to process submitted data , I would want to display an HTML Page
With a Message : ? Your Request is being Processed ? Please Wait?.
After the Processing is finished?..The appropriate Processed ASP Page should be displayed?

How can I achieve this ? Please Explain ?
0
Comment
Question by:bapireddy
  • 7
  • 5
  • 5
  • +8
30 Comments
 
LVL 29

Expert Comment

by:Göran Andersson
Comment Utility
Try this:

<div id="msg">Your Request is being Processed. Please wait...</div>
<%
Response.Flush
' process here...
%>
<script language="javascript">
window.msg.innerHTML='';
</script>
0
 

Expert Comment

by:santhoshgivesuanswers
Comment Utility
hi, the problem above is that the operation is so fast that the message is hardly visible.
it is correct.
but if the process is fast the the message is hardly visible.
rgds
san
0
 
LVL 29

Expert Comment

by:Göran Andersson
Comment Utility
Well, if the process is fast, then you don't have to see the message, right?
0
 
LVL 5

Expert Comment

by:dredge
Comment Utility
the easy way to do this required Windows 2000, and ASP 3.0



Please Wait While It's Being Processed.
<%
Server.Execute("/myfile.asp")
%>
0
 
LVL 29

Expert Comment

by:Göran Andersson
Comment Utility
dredge, and that helps in what way?
0
 
LVL 5

Expert Comment

by:dredge
Comment Utility
it helps by processing the file, while showing the current document on the screen.
0
 
LVL 29

Expert Comment

by:Göran Andersson
Comment Utility
Not quite.

Try it.

Server.Execute only works as an include. Unless you have enough html before it to fill the buffer, nothing will be sent to the browser, until the processing is done.

You need a Response.Flush to make the message appear.

A Response.Buffer=False at the top also works, but only because then a Response.Flush is executed before every <%.
0
 

Expert Comment

by:delu0007
Comment Utility
Try this alternative.

Create a page that contains only your message in the body, but contains the following header:

<HEAD>
  <meta HTTP-EQUIV="refresh" CONTENT="2; URL=yourfile.asp>
</HEAD>

The URL yourfile.asp refers to the program you want to execute.

The entire page would be something like:

<HTML>
 <HEAD>
  <meta HTTP-EQUIV="refresh" CONTENT="2; URL=yourfile.asp>
 </HEAD>
  Your Request is being Processed.  Please Wait...
 <BODY>
</HTML>

You may need to attach the Request.Form object to the end of the URL.
 </BODY>
0
 

Expert Comment

by:delu0007
Comment Utility
The <BODY></BODY> tags are kind of messed up in my last post, but I think you can figure out what I meant.
0
 
LVL 18

Expert Comment

by:mgfranz
Comment Utility
This is silly delu0007.

You are still waiting for the page to process even after the "Refresh".

Sounds like you need a COM object...
0
 

Expert Comment

by:delu0007
Comment Utility
If I am reading the question right, bapireddy is trying to display one page while a separate page is processing.

The code I provided will do just that.  I am currently using this method and it executes as follows:

1) Browser displaying Selection.asp
2) User fills out form and submits
3) Browser immediately displays WaitMsg.asp and processes
Results.asp
4) Browser displays complete Results.asp

0
 

Expert Comment

by:delu0007
Comment Utility
If I am reading the question right, bapireddy is trying to display one page while a separate page is processing.

The code I provided will do just that.  I am currently using this method and it executes as follows:

1) Browser displaying Selection.asp
2) User fills out form and submits
3) Browser immediately displays WaitMsg.asp and processes
Results.asp
4) Browser displays complete Results.asp

0
 
LVL 18

Expert Comment

by:mgfranz
Comment Utility
Yeah?  show me...

Your code;

<HTML>
<HEAD>
 <meta HTTP-EQUIV="refresh" CONTENT="2; URL=yourfile.asp>
</HEAD>
 Your Request is being Processed.  Please Wait...
<BODY>
</HTML>


Does nothing except redirects the page to "yourfile.asp" after 2 seconds.  What's even worse is that there is no form processing or handling.  If you passed your form values to this, they would be gone as soon as the redirect takes place.
0
 

Expert Comment

by:delu0007
Comment Utility
As I mentioned, you would need to append the Request.Form object to the yourfile.asp URL in order to pass the form values along.

Your probably right in that it redirects after 2 seconds, but the WaitMsg page would remain displayed until the Results.asp is finished processing.

I'm very new to the internet programming area, but this is a method that I have found to work for the situation that bapireddy is describing.
0
 
LVL 18

Expert Comment

by:mgfranz
Comment Utility
Not to be pessimistic, but your example does not process results.asp at all, it ddoes nothing to the form contents or the page that needs them.  It does not "work".

You will need a VB COM that gets a value passed to it when results are ready.
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 

Expert Comment

by:delu0007
Comment Utility
I don't know why it isn't working for you.  Perhaps my solution is browser dependent, or some other variable makes the difference -- but I know it works for me.

I'm not going to carry this debate any further.  I will wait and see if bapireddy responds to anything here before giving any more comments.
0
 
LVL 2

Expert Comment

by:Deathwish
Comment Utility
If all you want to do is show a message and then hide it and not use a component you can split the work up into two pages. Submit the form to the processing page. Then have something like below in the processing page:


<% Buffering.Buffer = true
<HTML>
<HEAD></HEAD>

<BODY>
Processing Request.....Please Wait....
<%
Response.Flush

.....rest of processing code here

Response.Redirect("finishedpage.asp")

%>

Basically they will see the message until the processing is done. Once done they will be redirected to a page that tells them all was done. If you did not want to do a seperate finish page, then you would have to use a component that would interact and send response back like mgfranz mentioned.
0
 

Author Comment

by:bapireddy
Comment Utility


 Hi friends,

      i am very happy to a good response

 i felt DELU0007 answer is near to my question.it will work .  

DeathWish answer is not work , Becoz if we use RESPONS.FLUSH , fisrst it displays "Please wait ......"
message but after finishing background process , resulted
html will append to "please wait .........." message.

One more thing , if we use RESPONSE.REDIRECT , we are going to lost Form data.
0
 
LVL 18

Expert Comment

by:mgfranz
Comment Utility
You will also loose the form data if you use; <meta HTTP-EQUIV="refresh" CONTENT="2; URL=yourfile.asp>
0
 
LVL 29

Expert Comment

by:Göran Andersson
Comment Utility
If you use my solution, you don't loose the form data.
0
 
LVL 9

Expert Comment

by:AlfaNoMore
Comment Utility
posting page:
------------------------------------

<script language="JavaScript">
function validateForm(){
  //process your form here.
  for (i=0; i <= document.this_form.count; i++) {
    if (document.this_form.elements[i].value == "") {
      alert ("this form field is empty!!");
    }
  }
  //if no alerts then
  document.this_form.submit();
}
</script>

<form method="post" action="process.asp" name="this_form" onSubmit="window.open('please_wait.html','waiting','width=300,height=150,etc.');">
Put all your form fields in here.

If you want form validation, you could do this either using javascript right here (which would be easier).
<input type="button" name="submit" value="Submit" onClick="validateForm();">
</form>

process page:
------------------------------------

Put all your ASP in here to write the data to the db, or whatever you're doing. After the processing has happened, display this code.

<html>
  <head>
    <title></title>
    <script language="JavaScript">
    function CloseProgressWindow() {
      window.open('','waiting','');
      // if it's already open, it won't action this!
      waiting.close();
    }
    </script>
  </head>
  <body onLoad="CloseProgressWindow();">
  </body>
</html>

waiting page:
---------------------------------------

Just have this display a waiting message. It may not stay on for long, but if you want something to display for a fraction of a second, this is the way to do it. Most users will accept a slight delay while the next page is loading anyway!


Hope this is enough for you?

Daniel.
0
 

Author Comment

by:bapireddy
Comment Utility
hi alfanomore,

    it will open a new window, i don't want open a new window. ofcourse  it is closed after background process is completed.

0
 
LVL 9

Expert Comment

by:AlfaNoMore
Comment Utility
Most "users" will be quite happy with this! Think what they might want?

Daniel.
0
 

Author Comment

by:bapireddy
Comment Utility
hi alfanomore,

    it will open a new window, i don't want open a new window. ofcourse  it is closed after background process is completed.

0
 
LVL 2

Expert Comment

by:Deathwish
Comment Utility
I don't think you are not going to get a perfect solution here. The window idea is what I have used before. Another I have used is this:

The process page -

<span id="Processing" style="position:absolute;top:90;left:expression((document.body.clientWidth / 2) - 225) ">
<center><TABLE><TR><TD width="450"><B><FONT COLOR="red" SIZE="+2">Loading Plan Provisions. Please Wait<span id="dots"></span></font></td></tr></table></span>
<script language="Javascript">
var intDotNum = 1
var DotTimer
LoadDots()

function LoadDots() {
     DotTimer = window.setInterval("DotProgress()",40)
}

function DotProgress() {
     var dots = ""
     var i = 0
     
     if (intDotNum == 6) {
          intDotNum = 1
     }
     else {
          intDotNum = intDotNum + 1
     }

     while (i < intDotNum) {
          dots = dots + "."
          i++
     }    
     document.all.dots.innerHTML = dots
}

</script>
<%

processing code here........................


%>
<script language="Javascript">
     var CtrlDots = document.all.Processing
     
     if (CtrlDots != null) {
          if (DotTimer != null) {
               window.clearInterval(DotTimer)
          }

          document.all.Processing.innerHTML = ""
     }
</script>

Buffering has to be set to false on the server for this to work. If it is off you would need to do a Response.Flush in the asp block. Also it has been tested only in IE. Not sure about Netscape here. Its similar to an idea GreenGhose had.
0
 
LVL 18

Expert Comment

by:mgfranz
Comment Utility
Yeah... there is no perfect solution other than writing a COM object.
0
 
LVL 1

Expert Comment

by:Computer101
Comment Utility
Hello experts.  Thoughts on closing this out? Delete, split?

Thank you
Computer101
Community Support Moderator
0
 
LVL 33

Expert Comment

by:hongjun
Comment Utility
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
[points to GreenGhost]

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

hongjun
EE Cleanup Volunteer
0
 

Expert Comment

by:delu0007
Comment Utility
Not to be greedy, but I think the response from the original question poster that was closest to accepting an answer was this one:

>Hi friends,
>
>     i am very happy to a good response
>
> i felt DELU0007 answer is near to my question.it will work .  
>
>DeathWish answer is not work , Becoz if we use RESPONS.FLUSH , fisrst it displays "Please wait ......"
>message but after finishing background process , resulted
>html will append to "please wait .........." message.
>
>One more thing , if we use RESPONSE.REDIRECT , we are going to lost Form data.

I think the original poster made it clear that he did not like GreenGhost's proposal.
0
 

Accepted Solution

by:
PashaMod earned 0 total points
Comment Utility
PAQ'ed and points not refunded,

PashaMod
Community Support Moderator @Experts Exchange
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now