Hello,
I have the following simple client code that needs to auth against a server. The server needs HTTP Header Auth to be added before doing any work.
The problem is I get this error:
Object reference not set to an instance of an object.
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim httpRequest As New HttpRequestMessageProperty()
' ERROR ON THE FOLLOWING LINE '
OperationContext.Current.OutgoingMessageProperties.Add(HttpRequestMessageProperty.Name, httpRequest)
Dim authByte As Byte()
authByte = Encoding.ASCII.GetBytes("aaaa:nbbbb=")
Dim base64 As String = Convert.ToBase64String(authByte)
httpRequest.Headers.Add("Authoriazation", "Basic " + base64)
End Sub ...
Go to the complete details ...