Hi,
We are getting same (417) error back in our website.
code:
public string ExecutePostCommand(string url, string userName, string
password, string data)
{
WebRequest request = WebRequest.Create(url);
if (!string.IsNullOrEmpty(userName) && !string.IsNullOrEmpty
(password))
{
request.Credentials = new NetworkCredential(userName,
password);
request.ContentType = "application/x-www-form-urlencoded";
request.Method = "POST";
if (!string.IsNullOrEmpty(TwitterClient))
{
request.Headers.Add("X-Twitter-Client",
TwitterClient);
}
if (!string.IsNullOrEmpty(TwitterClientVersion))
{
request.Headers.Add("X-Twitter-Version",
TwitterClientVersion);
}
if (!string.IsNullOrEmpty(TwitterClientUrl))
{
request.Headers.Add("X-Twitter-URL",
TwitterClientUrl);
}
if (!string.IsNullOrEmpty(Source))
{
data += "&source=" + HttpUtility.UrlEncode(Source);
}
byte[] bytes = Encoding.UTF8.GetBytes(data);
request.ContentLength = bytes.Length;
using (Stream requestStream = request.GetRequestStream())
{
requestStream.Write(bytes, 0, bytes.Length);
System.Net.ServicePointManager.Expect100Continue =
false;
using (WebResponse response = request.GetResponse())
{
using (StreamReader reader = new StreamReader
(response.GetResponseStream()))
{
return reader.ReadToEnd();
}
}
}
}
return null;
}
Please help me out,
Thanxs
Vivek Shrivastav
On Jan 2, 1:06 am, Joint Contact <[email protected]> wrote:
> Thanks for posting this information. We've applied these changes and
> our application is back to normal.
>
> Regards;
>
> -Wayne
>
> On Dec 23 2008, 8:31 pm, JakeS <[email protected]> wrote:
>
>
>
> > Looks like twitter is updating something and their servers are
> > returning error 417 for a lot of requests. I looked into it and found
> > that .NET automatically includes an Expect header containing "100-
> > continue" on every request unless you specifically tell it not to.
>
> > So for any .NET devs having trouble, you can set
> > System.Net.ServicePointManager.Expect100Continue = false before making
> > your request to get past this issue.- Hide quoted text -
>
> - Show quoted text -