473,503 Members | 1,647 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Web Service invoke as NT User

** 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, "u...@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 5 '07 #1
0 904

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
1907
by: Mr. B | last post by:
I've an application in which I use to check out the date/time stamp of a data base... and if I find that it has been updated, my application runs and does a particular update. Currently I fire...
11
1144
by: Mr. B | last post by:
I've an application in which I use to check out the date/time stamp of a data base... and if I find that it has been updated, my application runs and does a particular update. Currently I fire...
11
306
by: Mr. B | last post by:
I've an application in which I use to check out the date/time stamp of a data base... and if I find that it has been updated, my application runs and does a particular update. Currently I fire...
13
1922
by: NG | last post by:
Hi All I made a windows service in C#. Now I have a situation where I need to invoke an exe with some UI. Assuming that the computer running this service will always be logged in, can anyone...
3
13760
by: =?Utf-8?B?RGFuZGFuIFpoYW5n?= | last post by:
Now I have a web application, a web service and a SQL Server database. The Web application will invoke the web service, the web service invokes the SQL Server stored procedure. I let the web...
0
7201
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7083
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7278
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7456
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5011
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3166
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3153
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1510
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
734
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.