Setting HTTP Header Attributes

Discussion in 'ASP .Net Web Services' started by Eric, Aug 23, 2004.

  1. Eric

    Eric Guest

    Hello,

    I am writing an application that makes a number of web service calls
    to a variety of sources and aggregates the data back on a web page. A
    couple of the services require basic authentication information to be
    sent as part of the post request in the http header. I have tried
    setting up a credential cache and passing it as part of the service
    call, but when I do a tcp-trace of the resulting data, the credential
    information isn't passed in either the soap header or the http header.
    The rest of the message looks correct, but since the credentials
    aren't making it to the service, the message is rejected.

    Here is a copy of one of the routines:

    Private Sub btnGo_Click(ByVal sender As System.Object, ByVal e As
    System.EventArgs) Handles btnGo.Click
    Dim someService As aService.EmployeeService
    Dim credCache As System.Net.CredentialCache
    Dim netCredential As System.Net.NetworkCredential
    Dim myURI As System.Uri
    Dim EmployeeNumber as String
    Dim EmployeeName as String

    someService = New aCustomer.AccountService
    credCache = New System.Net.CredentialCache
    netCredential = New System.Net.NetworkCredential

    myURI = New System.Uri("http://hr1/services/EmployeeInfo")

    netCredential.UserName = "TestUser"
    netCredential.Password = Password.text
    EmployeeNumber = "12345"

    credCache.Add(myURI, "Basic", netCredential)

    someService.Credentials = credCache
    someService.PreAuthenticate = True

    EmployeeName =
    someService.findByEmployeeNumber(EmployeeNumber)
    End Sub

    Any help/guidance on how to add the credential information to the HTTP
    header would be greatly appreciated.

    Thanks
    - Eric
    Eric, Aug 23, 2004
    #1
    1. Advertising

  2. Eric

    Tim Gallivan Guest

    Eric,
    Have you had any response to this post? I, too, am looking for the same
    thing ...

    --
    Tim Gallivan
    I know I'm a great teacher because when I give a lesson, the person never
    comes back.

    "Eric" <> wrote in message
    news:...
    > Hello,
    >
    > I am writing an application that makes a number of web service calls
    > to a variety of sources and aggregates the data back on a web page. A
    > couple of the services require basic authentication information to be
    > sent as part of the post request in the http header. I have tried
    > setting up a credential cache and passing it as part of the service
    > call, but when I do a tcp-trace of the resulting data, the credential
    > information isn't passed in either the soap header or the http header.
    > The rest of the message looks correct, but since the credentials
    > aren't making it to the service, the message is rejected.
    >
    > Here is a copy of one of the routines:
    >
    > Private Sub btnGo_Click(ByVal sender As System.Object, ByVal e As
    > System.EventArgs) Handles btnGo.Click
    > Dim someService As aService.EmployeeService
    > Dim credCache As System.Net.CredentialCache
    > Dim netCredential As System.Net.NetworkCredential
    > Dim myURI As System.Uri
    > Dim EmployeeNumber as String
    > Dim EmployeeName as String
    >
    > someService = New aCustomer.AccountService
    > credCache = New System.Net.CredentialCache
    > netCredential = New System.Net.NetworkCredential
    >
    > myURI = New System.Uri("http://hr1/services/EmployeeInfo")
    >
    > netCredential.UserName = "TestUser"
    > netCredential.Password = Password.text
    > EmployeeNumber = "12345"
    >
    > credCache.Add(myURI, "Basic", netCredential)
    >
    > someService.Credentials = credCache
    > someService.PreAuthenticate = True
    >
    > EmployeeName =
    > someService.findByEmployeeNumber(EmployeeNumber)
    > End Sub
    >
    > Any help/guidance on how to add the credential information to the HTTP
    > header would be greatly appreciated.
    >
    > Thanks
    > - Eric
    Tim Gallivan, Aug 25, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Vivek Mehta
    Replies:
    3
    Views:
    8,663
    Vivek Mehta
    Aug 12, 2004
  2. mlt
    Replies:
    2
    Views:
    814
    Jean-Marc Bourguet
    Jan 31, 2009
  3. Eric

    Setting Content-Length Header for HTTP 204?

    Eric, Oct 20, 2004, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    226
  4. Mark Volkmann

    setting Expires HTTP response header

    Mark Volkmann, Jul 16, 2005, in forum: Ruby
    Replies:
    2
    Views:
    368
    David Heinemeier Hansson
    Jul 17, 2005
  5. Mark

    CGI.PM not setting HTTP header

    Mark, Nov 25, 2004, in forum: Perl Misc
    Replies:
    14
    Views:
    257
    Alan Mead
    Nov 26, 2004
Loading...

Share This Page