This project has moved. For the latest updates, please go here.

Newbie translate to

Jul 12, 2012 at 2:12 PM

great Lib! Trying to get this to work, although have the limitation that this needs to work in Vb.NET. Trying to make this part of the code work...

Any ideas?

PerformRedirect = authUrl => Response.Redirect(authUrl)

Jul 15, 2012 at 12:37 AM
Edited Jul 15, 2012 at 12:38 AM

Hi Unlink,

That's a lambda and you would write it like this in VB:

PerformRedirect = Function(authUrl) Response.Redirect(authUrl)



Jul 18, 2012 at 10:29 AM
Edited Jul 18, 2012 at 10:32 AM

You can write like this also:

Private auth As WebAuthorizer
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim twitterCtx As TwitterContext = New TwitterContext()
Dim credentials As IOAuthCredentials = New SessionStateCredentials()
If (credentials.ConsumerKey = Nothing Or credentials.ConsumerSecret = Nothing) Then
      credentials.ConsumerKey = ConfigurationManager.AppSettings("twitterConsumerKey")
      credentials.ConsumerSecret = ConfigurationManager.AppSettings("twitterConsumerSecret")
End If

'.NET 3.5  (Use this 2 lines if you running on .NET 3.5)
Dim authURL As Action(Of String) = AddressOf Response.Redirect
auth = New WebAuthorizer With {.Credentials = credentials, .PerformRedirect = authURL}

'.NET 4.0  (Use this single line if you running on .NET 4.0)
auth = New WebAuthorizer With {.Credentials = credentials, .PerformRedirect = Sub(authUrl) Response.Redirect(authUrl)} 

If (Not (Page.IsPostBack)) Then
End If

If (auth.IsAuthorized) Then
    lblAuth.Text = "Congratulations, you're authorized"
End if

twitterCtx = If(auth.IsAuthorized, New TwitterContext(auth), New TwitterContext())
End Sub

Dec 4, 2012 at 4:36 PM

I'm using this kind of code, but after .CompleteAuthorization the _auth.IsAuthorized is always false... :(

any idea?