1

我需要我的应用程序将输出上传到 pastebin 但我无法让它工作这是代码

        WebRequest wr = WebRequest.Create(@"http://pastebin.com/api_form.php");
        ASCIIEncoding encoding = new ASCIIEncoding();
        byte[] bData = encoding.GetBytes(string.Concat("paste_code=", sOutput, "&paste_private=0&paste_expire_date=1D&paste_subdomain=c4ca4238a0b923820dcc509a6f75849b"));
        wr.Method = "POST";
        wr.ContentType = "application/x-www-form-urlencoded";
        wr.ContentLength = bData.Length;
        Stream sMyStream = wr.GetRequestStream();
        sMyStream.Write(bData, 0, bData.Length);
        sMyStream.Close();

http://pastebin.com/api.php <-- api 来自那里

4

1 回答 1

5

直到您发送请求才真正发送wr.GetResponse();

这里,虽然这个例子是可耻的,因为它没有使用using{}

于 2010-05-17T23:29:42.933 回答