[Mono-bugs] [Bug 506734] System.Uri removes a slash and MS.NET does not

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sat Aug 28 23:43:03 EDT 2010



--- Comment #12 from mars guan <mars4thewin at dingtai.biz> 2010-08-29 03:42:58 UTC ---
Really appreciate your help!!! the slash problem is fixed after i followed your
suggestion!!!thanks! but My programme is struggleing with mono erros, when I
try to use something relates to GetResponse to
URL: "http://www.csdn.net/ " in my .net code, I get errors:

at System.Net.WebConnection.HandleError(WebExceptionStatus st, System.Exception
e, System.String where)
at System.Net.WebConnection.ReadDone(IAsyncResult result)
at System.Net.Sockets.Socket+SocketAsyncResult.Complete()
at System.Net.Sockets.Socket+Worker.Receive()

The getResponse function that get above errors is listed here:

public string GetRequestString(string strUrl,System.Text.Encoding
encodeType,bool allowAutoRedirect){
        int timeout = 20000;
        System.Net.HttpWebRequest myReq =
        myReq.Referer = "";
        myReq.Timeout = timeout;
        myReq.CookieContainer = null;
        myReq.Method = "get";
        myReq.KeepAlive = false;
        myReq.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB;
rv: Gecko/2010031422 Firefox/3.0.19 (.NET CLR 3.5.30729)";
        myReq.AllowAutoRedirect = allowAutoRedirect;

        System.Net.HttpWebResponse HttpWResp =
        System.IO.Stream myStream = HttpWResp.GetResponseStream();

        System.IO.MemoryStream ms = new System.IO.MemoryStream();
        int index = 0;
        Byte[] b = new byte[4096];

        int count = myStream.Read(b, 0, b.Length);
        if(count <= 0)break;
            ms.Write(b, 0, count);

        byte[] read = new byte[ms.Length];
        ms.Position = 0;
        ms.Read(read, 0, (int)ms.Length);

        return encodeType.GetString(read);

Also when I use the above function on URL:
I get error:
The remote server returned an error: (405) Method Not Allowed.

if I use this function to some other pages in URL:www.news.cn, I may get error
:(400) or error :(501)

the code I listed works perfectly fine in .Net 3.5 framework, but when I use
mono 2.6.7, I get struggled. I believe it is problem caused by Mono that is
supposed to help .Net project run, right?

Really appreciate if you can help!! or Can I add your MSN please?

Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.

More information about the mono-bugs mailing list