I created a desktop application (vb.net) which access my webservice. I have a
client which is behind a firewall and can not log on to the webservice. They
have been getting the error: System.Net.WebException: The request failed with
HTTP status 403: Forbidden.
Any ideas on what I can do. Here is my code.
Dim myService As New AIMWS.DataServ1Wse
Dim proxyObject As New System.Net.WebProxy(m_strURLLocation, True)
myService.Proxy = proxyObject
myService.Ping()
<System.Web.Services.Protocols.SoapDocumentMethodA ttribute(WebServiceAddress
& "/Ping", RequestNamespace:=WebServiceAddress,
ResponseNamespace:=WebServiceAddress,
Use:=System.Web.Services.Description.SoapBindingUs e.Literal,
ParameterStyle:=System.Web.Services.Protocols.Soap ParameterStyle.Wrapped)> _
Public Function Ping() As Integer
Dim results() As Object = Me.Invoke("Ping", New Object(-1) {})
Return CType(results(0),Integer)
End Function
<WebMethod()> Public Function Ping() As Integer
If Authenticater() Then
' Just make sure that Ping works, to see if the web service is
valid
End If
End Function
Private Function Authenticater() As Boolean
Dim requestContext As SoapContext = HttpSoapContext.RequestContext
Dim userToken As UsernameToken
Dim returnValue As String
If requestContext Is Nothing Then
Throw New SoapException("Non-SOAP Message - Are you a hacker?",
SoapException.ClientFaultCode)
End If
For Each userToken In requestContext.Security.Tokens
If TypeOf userToken Is UsernameToken Then
If userToken.PasswordOption = PasswordOption.SendHashed Then
Return True
Exit For
Else
Throw New SoapException("Password must be hashed",
SoapException.ClientFaultCode)
End If
End If
Next
End Function
--
Thanks,
JeffS