Parameter Sort not working in VB.NET Class (and Fix)
Opened this issue · 0 comments
GoogleCodeExporter commented
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 hal.nesb...@gmail.com
on 10 Jul 2013 at 8:46