By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
460,045 Members | 1,367 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 460,045 IT Pros & Developers. It's quick & easy.

Web Service invoke as nt user

P: n/a
** 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, "us**@email.co.nz", "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?

Jul 4 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
<snipped>
>
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.
Jul 5 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.