Hi Steven
Sorry this skipped being read as my newsreader settings didn't read all
headers (fixed now)
I manually set it because the preauthentication flag doesn't work for
webservice - this is a known bug.
I also do not want to turn on basic authentication to make it work as I need
to handle the basic authentication using my own httphandler to check the
credentials.
(I also do not have the correct permission on the domain involved to add my
own users and thus I cannot use IIS basic authentication - unless you know
of another way of supplying username/password combinations)
Try turning off the basic authentication and looking for the authorization
field within the application (ps you will need to use my code to get
preauthentication to work) - see my original example.
Shaun
"Steven Cheng[MSFT]" <v-schang@online.microsoft.com> wrote in message
news:nsBFlzc0EHA.2544@cpmsftngxa10.phx.gbl...[color=blue]
> Hi Shaun,
>
> Thanks for your response. Yes, I've just tested on a w2k server(iis5) with
> framework1.1 ,but the behavior is the same as I tested on other[/color]
enviorment,[color=blue]
> the Authorization header is sent correctly.
> Have you tried changing to use another custom Header Name such as
>
> webReq.Headers.Add("myheaderitem", "myheadervalue")
>
> to see whether it can be sent correctly?
>
> In addition, I'm a bit confused that why you need to manually set the[/color]
HTTP[color=blue]
> authorization header? When we add the following code
>
> Dim cache As New System.Net.CredentialCache
> Dim cred As New System.Net.NetworkCredential("IWTeamMember1",
> "Password01!", "sha-dng-chn")
> cache.Add(New
> Uri(System.Configuration.ConfigurationSettings.App Settings("Uri")),
> "Basic", cred)
> ws.Credentials = cache
>
> the webrequest will automatically add the HTTP authorization header for[/color]
us.[color=blue]
> That means, even we don't override the GetWebRequest and manually add[/color]
the[color=blue]
> header, the webrequest will generate the header for use according to the
> NewworkCrediential we add in the CredentialCache. I've tested this to
> confirm this behavior. Have you also tried this?
>
> Just turn on the IIS's BASIC authentication and run the following code at
> client
>
> Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles Button1.Click
>
> Try
> Dim service As New AuthTestService.AuthTestService
>
> Dim cache As New System.Net.CredentialCache
> Dim cred As New System.Net.NetworkCredential("username",
> "password!", "servername")
> cache.Add(New
> Uri(System.Configuration.ConfigurationSettings.App Settings("Uri")),
> "Basic", cred)
> service.Credentials = cache
>
> MessageBox.Show(service.HelloWorld())
>
>
> Catch ex As Exception
>
> MessageBox.Show(ex.ToString())
> End Try
>
> this can return "HelloWorld" correctly.
>
> Please have a check and let me know if there is anything unclear. Thanks.
>
> Regards,
>
> Steven Cheng
> Microsoft Online Support
>
> Get Secure!
www.microsoft.com/security
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
>
>
>
> End Sub
>
>[/color]