Almost. request.PreAuthenticate still sends a double request the first time.
Behind corporate firewalls (where multiple clients may be getting aggregated
to one IP address), you can still hit the unauth'ed rate limit.

I'll try tomorrow at work (where I can usually repro the above situation)
and report back.

JD

On Tue, Apr 7, 2009 at 11:29 AM, Dimebrain <daniel.cre...@gmail.com> wrote:

>
> Isn't request.PreAuthenticate = true functionally equivalent to adding
> the credentials manually to avoid the double calls?
>
> On Apr 5, 1:21 am, James Deville <james.devi...@gmail.com> wrote:
> > Look at what requests you are sending with Netmon or Wireshark. With
> Witty
> > (C# wpf app), we discovered that first an unauthenticated request is sent
> to
> > find out what auth the server takes, then a authenticated request after
> > that. This doesn't work on some of the API requests. The solution is to
> > manually attach the BasicAuth header.
> >
> > JD
> >
> > On Sat, Apr 4, 2009 at 11:38 AM, DIENECES <bowling.j...@gmail.com>
> wrote:
> >
> > > Any idea why I'm forbidden?
> > > Thanks in advance!
> > > Function writeMessage(ByVal StrPass, ByVal StrUser, ByVal StrMessage,
> > > ByVal StrTo) As String
> > >        Dim req As System.Net.HttpWebRequest =
> > > System.Net.HttpWebRequest.Create("http://twitter.com/direct_messages/
> > > new.xml?user= <http://twitter.com/direct_messages/%0Anew.xml?user=>" +
> > > StrTo + "&text=" + StrMessage)
> > >        If Not StrUser = "" Or StrPass = "" Then
> > >            req.Credentials = New System.Net.NetworkCredential
> > > (StrUser, StrPass)
> > >            req.Method = "POST"
> > >            'req.ContentLength = 0
> > >            'req.ServicePoint.Expect100Continue = False
> > >            req.ContentType = "application/x-www-form-urlencoded"
> > >            'req.PreAuthenticate = True
> > >            Dim resp As HttpWebResponse = req.GetResponse()
> > >            Dim sr As New System.IO.StreamReader(resp.GetResponseStream
> > > ())
> > >            'sr.Read(req.GetResponse(), )
> > >            Return sr.ReadToEnd()
> > >        End If
> >
> > >    End Function
>

Reply via email to