void DownloadAssembly (Uri uri, int errorCode)
{
Uri xap = new Uri (NativeMethods.plugin_instance_get_source_location (PluginHost.Handle));
// WebClient deals with relative URI but HttpWebRequest does not
// but we need the later to detect redirection
if (!uri.IsAbsoluteUri) {
uri = new Uri (xap, uri);
} else if (xap.Scheme != uri.Scheme) {
throw new SecurityException ("Cross scheme URI downloading " + uri.ToString ());
}
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (uri);
req.BeginGetResponse (AssemblyGetResponse, new object[] { req, errorCode });
}