S
Shaun Wilde
I am not sure if this is a .NET bug/feature and IIS5 one or a combination of
the 2 so here goes
I have a situation where when I call an ASP.NET webservice running under
windows 2000 (I assume IIS5) with a webservice client also in .NET that the
webservice request loses the Authorization HTML header.
This DOES NOT happen under Windows 2003.
I am using the followng (patch/fix) to preauthenticate the web request (this
is from a KB article, or newsgroup article I think)
Protected Overrides Function GetWebRequest(ByVal uri As System.Uri) As
System.Net.WebRequest
Dim webReq As System.Net.WebRequest = MyBase.GetWebRequest(uri)
If Me.PreAuthenticate Then
Dim cred As System.Net.NetworkCredential =
Me.Credentials.GetCredential(uri, "Basic")
If Not cred Is Nothing Then
Dim buff As Byte() = New
System.Text.UTF8Encoding().GetBytes(cred.UserName & ":" & cred.Password)
webReq.Headers("Authorization") = "Basic " &
Convert.ToBase64String(buff)
End If
End If
Return webReq
End Function
Also webservice and client are running under the same process/application -
long story but it is to fake the fact that the server we are supposed to
talk to isn't available yet.
i.e. under my webservice I have 2 folders - in one folder I have the .asmx
files that our web application talks to and under the other folder I have a
..asmx that responds the way the 3rd party service is supposed to
with requests to the first folder causing a request to the second.
I hope someone can tell me what is going on.
Regards
Shaun
the 2 so here goes
I have a situation where when I call an ASP.NET webservice running under
windows 2000 (I assume IIS5) with a webservice client also in .NET that the
webservice request loses the Authorization HTML header.
This DOES NOT happen under Windows 2003.
I am using the followng (patch/fix) to preauthenticate the web request (this
is from a KB article, or newsgroup article I think)
Protected Overrides Function GetWebRequest(ByVal uri As System.Uri) As
System.Net.WebRequest
Dim webReq As System.Net.WebRequest = MyBase.GetWebRequest(uri)
If Me.PreAuthenticate Then
Dim cred As System.Net.NetworkCredential =
Me.Credentials.GetCredential(uri, "Basic")
If Not cred Is Nothing Then
Dim buff As Byte() = New
System.Text.UTF8Encoding().GetBytes(cred.UserName & ":" & cred.Password)
webReq.Headers("Authorization") = "Basic " &
Convert.ToBase64String(buff)
End If
End If
Return webReq
End Function
Also webservice and client are running under the same process/application -
long story but it is to fake the fact that the server we are supposed to
talk to isn't available yet.
i.e. under my webservice I have 2 folders - in one folder I have the .asmx
files that our web application talks to and under the other folder I have a
..asmx that responds the way the 3rd party service is supposed to
with requests to the first folder causing a request to the second.
I hope someone can tell me what is going on.
Regards
Shaun