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
309 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
ID: 6417366
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
ID: 6417406
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
ID: 6417431
Well, if the process is fast, then you don't have to see the message, right?
0
 
LVL 5

Expert Comment

by:dredge
ID: 6417513
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
ID: 6417827
dredge, and that helps in what way?
0
 
LVL 5

Expert Comment

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

Expert Comment

by:Göran Andersson
ID: 6417977
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
ID: 6418108
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
ID: 6418117
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
ID: 6418163
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
ID: 6418201
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
ID: 6418202
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
ID: 6418222
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
ID: 6418270
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
ID: 6418552
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Expert Comment

by:delu0007
ID: 6418648
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
ID: 6420521
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
ID: 6420697


 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
ID: 6420702
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
ID: 6420907
If you use my solution, you don't loose the form data.
0
 
LVL 9

Expert Comment

by:AlfaNoMore
ID: 6421276
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
ID: 6421314
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
ID: 6421419
Most "users" will be quite happy with this! Think what they might want?

Daniel.
0
 

Author Comment

by:bapireddy
ID: 6421471
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
ID: 6421772
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
ID: 6421888
Yeah... there is no perfect solution other than writing a COM object.
0
 
LVL 1

Expert Comment

by:Computer101
ID: 6716571
Hello experts.  Thoughts on closing this out? Delete, split?

Thank you
Computer101
Community Support Moderator
0
 
LVL 33

Expert Comment

by:hongjun
ID: 8722784
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
ID: 8731339
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
ID: 8776179
PAQ'ed and points not refunded,

PashaMod
Community Support Moderator @Experts Exchange
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

911 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

16 Experts available now in Live!

Get 1:1 Help Now