Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parameter Sort not working in VB.NET Class (and Fix) #238

Open
GoogleCodeExporter opened this issue Apr 6, 2016 · 0 comments
Open

Parameter Sort not working in VB.NET Class (and Fix) #238

GoogleCodeExporter opened this issue Apr 6, 2016 · 0 comments

Comments

@GoogleCodeExporter
Copy link

The hosted VB.NET class has a parameter sort class within it that is supposed 
to sort the parameters alphabetically (which is required by oAuth; the 
signature will fail if not), but it does not work and the sort line appears to 
be commented out:

'parameters.Sort(New QueryParameterComparer())

To fix, you need to add an Implements interface to the QueryParameterComparer 
class to the class itself and the function within the class to allow it to 
interface with the generic comparer. So the complete QueryParameterComparer 
class should read:

        Protected Class QueryParameterComparer
    Implements System.Collections.Generic.IComparer(Of OAuthBase.QueryParameter)

    #Region "IComparer<QueryParameter> Members"
        Public Function Compare(ByVal x As QueryParameter, ByVal y As QueryParameter) As Integer Implements IComparer(Of OAuthBase.QueryParameter).Compare
                If (x.Nome = y.Nome) Then
                    Return String.Compare(x.Valor, y.Valor)
                Else
                    Return String.Compare(x.Nome, y.Nome)
                End If
            End Function
    #End Region
        End Class

Just replace that, uncomment the parameters.Sort line, and the comparer will 
sort all parameters, including those in the original URI, so you can sign and 
authenticate (just tested with Twitter and it works fine).

Cheers,

Hal

Original issue reported on code.google.com by [email protected] on 10 Jul 2013 at 8:46

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant