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 / Caching / March 2004

Tip: Looking for answers? Try searching our database.

asynchronous call back and session variables.....

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ollie - 19 Mar 2004 15:08 GMT
I have an asp.net webservice that is called from an asp.net website, the
processes on the web service may take sometime so I call the webservice
using the asynchronous method calls, i.e. BeginXXXX(), EndXXXX() etc...

I pass a call back into the BeginXXX method so that when the operation has
completed the call back method is called.....

So in the web page it looks something like this:-

private void BeginUpdateData()
{
      AsyncCallback AsyncCallBack = new AsyncCallback(UpdateCallback);
      System.IAsyncResult asyncResult =
Analyser.BeginUpdateXXXX(serializedData, AsyncCallBack, null);

      Session["Processing"] = true;
      Session["ProcessingMessage"] = "Updating Entry....";
      Session["ProcessingRefreshTime"] = 2;
      Session["ProcessingRedirectPath"] = Request.Path;
      Response.Redirect(Request.ApplicationPath +
"/Analysis/Processing.aspx", true);
}

public void UpdateCallback(IAsyncResult ar)
{
      EndUpdateData(ar);
}

private void EndUpdateData(System.IAsyncResult asyncResult)
{
   string data = null;
   data = Analyser.EndUpdateXXXX(asyncResult);

    Session["Processing"] = null;
}

And the processing.aspx page_load is:

private void Page_Load(object sender, System.EventArgs e)
{
      if(Session["Processing"] == null)
      {
            Session["ProcessingMessage"] = null;
            Session["ProcessingRefreshTime"] = null;

            string redirectPath =
(string)Session["ProcessingRedirectPath"];
            Session["ProcessingRedirectPath"] = null;

            Response.Redirect(redirectPath);
      }

     string message = (string)Session["ProcessingMessage"];
     int refreshTime = (int)Session["ProcessingRefreshTime"];

     Response.AddHeader("Refresh", refreshTime.ToString());
     lbProcessing.Text = message;
}

The problem is that when the asynchronous call back is called it clears the
session variable "Processing", BUT next time the processing.aspx page
refreshes the session variable still exists with the value 'true' to
therefore it does not redirect. I am using out-of-proc session management
using StateServer

Have I made a simple mistake?

Can anyoen help ?

Cheers in Advance

Ollie
Ollie - 19 Mar 2004 16:12 GMT
found this, bascially saying you can't use ansychonrous callbakcs with
StateServer or SqlServer for session mamanagement

http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=uc3980iGDHA.
3260%40tk2msftngp13.phx.gbl&rnum=1&prev=/groups%3Fq%3DStateServer%2Basynchronous
%26hl%3Den%26lr%3D%26ie%3DUTF-8%26oe%3DUTF-8%26selm%3Duc3980iGDHA.3260%2540tk2ms
ftngp13.phx.gbl%26rnum%3D1


> I have an asp.net webservice that is called from an asp.net website, the
> processes on the web service may take sometime so I call the webservice
[quoted text clipped - 68 lines]
>
> Ollie

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.