[Mono-dev] Internet code which is fine under .NET, but dies on mono

Paul Johnson paul at all-the-johnsons.co.uk
Fri Mar 11 07:56:58 EST 2011


I have a bit of a problem with some come which works and builds fine under
VS2010 (targetting .NET 2) but returns a problem under mono on my linux box
(using 2.10.1) - here is the code

        private void btnTranslate_Click(object sender, EventArgs e)
            string result = string.Empty;
            string url = string.Format("
                key, txtTranslate.Text, data.from, data.to);
                WebRequest req = HttpWebRequest.Create(url);
                if (data.useproxy == true)
                        WebProxy myproxy = new WebProxy(data.proxyval,
                        myproxy.BypassProxyOnLocal = false;
                        req.Proxy = myproxy;
                req.Method = "GET";

                using (WebResponse res = req.GetResponse())
                    using (StreamReader sr = new
StreamReader(res.GetResponseStream(), Encoding.UTF8))
                        result = sr.ReadToEnd();
            catch (Exception er)
                MessageBox.Show(er.Message, "Network error",

The code will fire up fine under mono, but fails to communicate with the
google service complaining that it was able decode the returned string or
the end of the string has been found,

Any ideas or do I need to put this into the mono BZ?

The binary can be found at http://www.all-the-johnsons.co.uk/translate.exe


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20110311/759aabd7/attachment.html 

More information about the Mono-devel-list mailing list