Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / February 2005

Tip: Looking for answers? Try searching our database.

Display 'In Process' page when calling async WebService

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Homa - 22 Feb 2005 02:40 GMT
Hi all,

Can anyone give me some links about how to do an async web service call
from aspx and display a temperary page before the web service returns?

Thanks,
Homa Wong
DotNetJerome - 22 Feb 2005 05:47 GMT
Hi,

Hopefully the following link may help you.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cp
coninvokingwebservicesasynchronously.asp


cheers,

Jerome. M

> Hi all,
>
[quoted text clipped - 3 lines]
> Thanks,
> Homa Wong
DotNetJerome - 22 Feb 2005 06:01 GMT
Hi,

The Following link may help you to understand beeterly about the waithandle.
I hope you can make you of this, to display the "In Process Page" during your
async call.

Cheers,

Jerome. M

> Hi all,
>
[quoted text clipped - 3 lines]
> Thanks,
> Homa Wong
homawong@gmail.com - 22 Feb 2005 19:47 GMT
Hi,

The problem with ASP.NET is when a "In Progress page" is displayed, the
HttpContext already end response, i.e., all information are sent to the
client. So when a callback returns, nothing more can be written to the
client's browser. And if I do a redirect, it result an error because
the code behind class doesn't know which browser it should communicate
to (because it ended response to the browser thus the client browser is
in a "disconnected" state).
I can think of two ways to do this.

1. Use JavaScript.
  Have a timed redirect script inject to the "In Progress page." When
times up, the page redirects to the result page and if the result is
not ready, it goes back to the "In progress page" and wait again until
the result is ready (or timeout). The problem of this is the timed
parameter is fixed because you don't know in real time how long will
the web service take to return your call. So in the worst case it takes
twice as long to get the result (of course, this can be reduced but
it's kind of like a passive fix to the problem).

2. Tell the "In progress page" to send part of the page to the client
browser while waiting for the result. This would be ideal but I don't
know how to do it.

I don't have much problem dealing with async call directly, but how the
Page and the Client browser interact to get the solution works.

The solution I want is like the bank websites that after you login, it
display a page saying "We are gathering your information..." and then
direct you to summary page of your bank account.

Thanks,
Homa Wong

> Hi,
>
[quoted text clipped - 13 lines]
> > Thanks,
> > Homa Wong
Trevor Pinkney - 23 Feb 2005 19:23 GMT
I've never done this before but I imagine you need Response.Flush... something
like this.  

        private void Page_Load(object sender, System.EventArgs e)
        {
            Response.Write("Wait 4 Seconds...<BR><BR>");
            Response.Flush();

            System.Threading.Thread.SpinWait(99999999);
           
            Response.Write("4 seconds is up.  Redirecting in 4 seconds to google.com");
            Response.Flush();

            System.Threading.Thread.SpinWait(99999999);
            Response.Write("<script>window.location='http://www.google.com';</script>");
            Response.End();
        }

For some reason this code I have posted doesn't totally work cause sometimes
the 'wait 4 seconds' message doesn't show up.  Its just to give you an idea
and you can play around with it.

http://blogs.msdn.com/nunos/archive/2004/03/12/88489.aspx#FeedBack might
help you.

-Trevor

> Hi,
>
[quoted text clipped - 60 lines]
>>> Thanks,
>>> Homa Wong
Homa - 23 Feb 2005 19:50 GMT
Hi,
 I actually found the solution. Here is the link.

http://msdn.microsoft.com/msdnmag/issues/03/12/designpatterns/default.aspx

Cheers,
Homa Wong

> I've never done this before but I imagine you need Response.Flush... something
> like this.
[quoted text clipped - 10 lines]
>
>             System.Threading.Thread.SpinWait(99999999);

            Response.Write("<script>window.location='http://www.google.com';</script>");
>             Response.End();
>         }
[quoted text clipped - 72 lines]
> >>> Thanks,
> >>> Homa Wong

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.