views:

73

answers:

3

I'm trying to use TweetSharp in a DLL Library.

When I execute the following code in a DLL Library, the response returns invalid (417 Unknown):

var verify = FluentTwitter.CreateRequest()
    .AuthenticateWith("<HIDDEN>",
        "<HIDDEN>",
        "<HIDDEN>",
        "<HIDDEN>")
    .Statuses().Update("It works!");

var response = verify.Request();

When I execute the same code in a Windows Application, the response returns correctly.

Is there any thing (configuration) that could process HTTP Requests (using POST) differently using the same code in DLL Library and Windows Application?

A: 

Probably its current logged user related

Try to log with your website application pool user and run your code again

Rubens Farias
+1  A: 

most likely, the library has the "Expect100Continue" set to true. It should be set to false.

http://groups.google.com/group/twitter-api-announce/browse%5Fthread/thread/7be3b64970874fdd

Looks as though this library needs to be updated. This was changed about 10 months ago.

So the code should something like this...

 HttpWebRequest request = (HttpWebRequest)WebRequest.Create(newURL);
 request.Method = "POST";
 request.ServicePoint.Expect100Continue = false;
 request.ContentType = "application/x-www-form-urlencoded";
Eclipsed4utoo
+1  A: 

TweetSharp definitely handles the Expect100Continue issue, so something else is at play here. What does your policy file look like? You need to make sure you can send HTTP requests from DLLs if you're in a medium trust environment by modifying your policy.

Daniel Crenna