title: UploadStringAsync CallBack Return Type
body: <p>I have a web service where I Post to a URL Asynchronously</p>
  
  <pre><code>public Response uploadXMLData(string destinationUrl, string requestXml,Request req)
  {
      try
      {
          Response resp=new Response();
          System.Uri uri = new System.Uri(destinationUrl);
          using (WebClient client = new WebClient())
          {
  
              client.UploadStringCompleted
         += new UploadStringCompletedEventHandler(UploadStringCallback); 
  
              client.UploadStringAsync(uri, "POST",requestXml,req);
          }
      }
  
      catch (Exception ex)
      {}
  
      return resp;
  }
  
  public void UploadStringCallback(object sender, UploadStringCompletedEventArgs e)
  {
      Response resp=new Response();
      Request req = new Request();
      try 
      {
          if (e.Error != null)
          {
              object objException = e.Error.GetBaseException();
  
              Type _type = typeof(WebException);
              if (_type != null)
              {
                  WebException objErr = (WebException)e.Error.GetBaseException();
                  WebResponse rsp = objErr.Response;
                  using (Stream respStream = rsp.GetResponseStream())
                  {
                     req= (Request)e.UserState;
                     resp=Utilities.ParseWithoutSoapEnv(respStream);
  
                  }
  
              }
              else
              {
                  Exception objErr = (Exception)e.Error.GetBaseException();
                  throw objErr;
              }
          }
          else
          { 
          //Parse e.Result
          }
      }
      catch (Exception ex)
      {}
  }
  </code></pre>
  
  <p>The Function Called <code>Utilities.ParseWithoutSoapEnv(respStream);</code> returns Type <code>Response</code></p>
  
  <p>what I want to do is get the Response from that function, and make it the return value for <code>uploadXMLData</code></p>
  
  <p>But I can't change the return type of a CallBack Function, so I have no idea what to do.</p>
  
  <p>When someone calls my webservice function, they expect it to return a type of <code>Response</code>, and the <code>Response</code> class I need is being received to the CallBack function..</p>
  
  <p>Hope I made my issue clear</p>
  
  <p>Any help would be appreciated</p>