[twitter-dev] Re: VB.net auh failure [403]

2009-04-08 Thread Dimebrain

I confirmed this is still happening by tracing with wireshark last
night; so my expectation for preauthenticate was wrong as it doesn't
stop the initial grab for authentication flavor; setting the header
yourself does the trick for that first call.

On Apr 8, 2:21 am, James Deville james.devi...@gmail.com wrote:
 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


[twitter-dev] Re: VB.net auh failure [403]

2009-04-07 Thread DIENECES

Yes. What's interesting about this is that my authentication function
works for getting and posting updates on my personal timeline.

On Apr 6, 12:39 pm, Doug Williams d...@twitter.com wrote:
 What message accompanied the 403 response code?

 Doug Williams
 Twitter API Supporthttp://twitter.com/dougw



 On Sun, Apr 5, 2009 at 11:12 AM, DIENECES bowling.j...@gmail.com wrote:

  That's a great suggestion.  Thanks for the help. Ill post my modified
  code in case anyone else wants some VB (even though it seems to be the
  black-sheep) of the twitter development family ;).

  On Apr 5, 12: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- Hide quoted text -

  - Show quoted text -- Hide quoted text -

 - Show quoted text -


[twitter-dev] Re: VB.net auh failure [403]

2009-04-07 Thread Dimebrain

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


[twitter-dev] Re: VB.net auh failure [403]

2009-04-07 Thread James Deville
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



[twitter-dev] Re: VB.net auh failure [403]

2009-04-06 Thread Doug Williams

What message accompanied the 403 response code?

Doug Williams
Twitter API Support
http://twitter.com/dougw



On Sun, Apr 5, 2009 at 11:12 AM, DIENECES bowling.j...@gmail.com wrote:

 That's a great suggestion.  Thanks for the help. Ill post my modified
 code in case anyone else wants some VB (even though it seems to be the
 black-sheep) of the twitter development family ;).

 On Apr 5, 12: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- Hide quoted text -

 - Show quoted text -



[twitter-dev] Re: VB.net auh failure [403]

2009-04-05 Thread DIENECES

That's a great suggestion.  Thanks for the help. Ill post my modified
code in case anyone else wants some VB (even though it seems to be the
black-sheep) of the twitter development family ;).

On Apr 5, 12: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- Hide quoted text -

 - Show quoted text -


[twitter-dev] Re: VB.net auh failure [403]

2009-04-04 Thread James Deville
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