Web Service invoke as nt user

B

backwards15

** This is the windows form code **

Private Sub btn_log_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) 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.SmtpClient

mail.Host = "exchange server"

mail.UseDefaultCredentials = True

'mail.Send(getmail.GetCurrentUserEmail, "(e-mail address removed)", "call
request", msg)

MessageBox.Show(ws.GetCurrentUserEmail)

End Sub

** This is the webservice code **

<WebMethod()> _

Public Function GetCurrentUserEmail() As String

Dim dSearch As DirectorySearcher = New DirectorySearcher()

dSearch.SearchRoot = New DirectoryEntry("LDAP://DC=Domain
name,DC=co,DC=nz", "CN=user,OU=Users,DC=domain name,DC=co,DC=nz",
"password")

dSearch.Filter = "(&(objectCategory=User)(samAccountName=" +
Environment.UserName + "))"

Dim sResult As SearchResult = dSearch.FindOne()

Dim currentUser As DirectoryEntry = sResult.GetDirectoryEntry()

Return currentUser.Properties("mail").Value.ToString()

End Function



When I try to run ws.getcurrentuseremail() it invokes the web service
as IUSR_Computername.
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?
 
M

Mr. Arnold

When I try to run ws.getcurrentuseremail() it invokes the web service
as IUSR_Computername.
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.donnet.framework.webservice.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top