Web Service invoke as nt user

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • backwards15@gmail.com

    #1

    Web Service invoke as nt user

    ** This is the windows form code **

    Private Sub btn_log_Click(B yVal sender As System.Object, ByVal e As
    System.EventArg s) Handles btn_log.Click

    Dim msg As String

    Dim ws As New ADWS.Service

    msg = "testing this mail message"
    Dim mail As New Net.Mail.SmtpCl ient

    mail.Host = "exchange server"

    mail.UseDefault Credentials = True

    'mail.Send(getm ail.GetCurrentU serEmail, "user@email.co. nz", "call
    request", msg)

    MessageBox.Show (ws.GetCurrentU serEmail)

    End Sub

    ** This is the webservice code **

    <WebMethod()_

    Public Function GetCurrentUserE mail() As String

    Dim dSearch As DirectorySearch er = New DirectorySearch er()

    dSearch.SearchR oot = New DirectoryEntry( "LDAP://DC=Domain
    name,DC=co,DC=n z", "CN=user,OU=Use rs,DC=domain name,DC=co,DC=n z",
    "password")

    dSearch.Filter = "(&(objectCateg ory=User)(samAc countName=" +
    Environment.Use rName + "))"

    Dim sResult As SearchResult = dSearch.FindOne ()

    Dim currentUser As DirectoryEntry = sResult.GetDire ctoryEntry()

    Return currentUser.Pro perties("mail") .Value.ToString ()

    End Function



    When I try to run ws.getcurrentus eremail() it invokes the web service
    as IUSR_Computerna me.
    How ever if I run the web service directly it runs as my account domain
    \username

    How do I get the web service to run from the windows app as the
    locally logged on user?

  • Mr. Arnold

    #2
    Re: Web Service invoke as nt user

    <snipped>
    >
    When I try to run ws.getcurrentus eremail() it invokes the web service
    as IUSR_Computerna me.
    How ever if I run the web service directly it runs as my account domain
    \username
    >
    How do I get the web service to run from the windows app as the
    locally logged on user?
    >
    You might want to post to MS.public.donne t.framework.web service.

    Comment

    Working...