mercredi 17 juin 2015

returning variable from EndInvoke

I have a method that runs in it's own thread via BeginInvoke.

caller.BeginInvoke(pId, sID.Value, pi, vIRB, a, sls, aspNetUserID.Value, pbID, CreateComplete, caller);

The CreateComplete method is the callback it does after it's done.

    private void CreateComplete(IAsyncResult result)
    {
        Caller caller = (Caller)result.AsyncState;
        string fileName = caller.EndInvoke(result);
    }

It generates a file that needs to be downloaded. Before I threaded things I returned the file path to javascript and had it open a window to that location to download the file.

I tried storing it as a Session variable, passing the HTTPContext.Current to the BeginInvoke method, but that is null when it arrives.

How can I save the returned file path so that I can do something similar in the new threaded system.

Aucun commentaire:

Enregistrer un commentaire