473,408 Members | 2,832 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

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, "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
1 1277
<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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
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...
1
by: Ken Allen | last post by:
I am experimenting with a new facility that will replace an existing client/server environment that uses named pipes for communication. The client application uses SHBrowseForFolder standard...
1
by: Gregory Hassett | last post by:
Hi, I have a web service called GetComputerNameAndDescription which I can call from the main thread of my app. If I call it from a separate thread, however, it hangs on the call to Invoke() -- but...
6
by: Siegfried Heintze | last post by:
I have the following C# code in my web service: public static extern double add_(double X, double Y ); public double add (double X, double Y){ return add_(X, Y); }
0
by: cnSoftware | last post by:
I come across this problem during my recent project and even now I am still be puzzled by it. So I paste the procedure here. I wish you can figure out where I am wrong or missing. The sample...
13
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
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...
33
by: JamesB | last post by:
I am writing a service that monitors when a particular app is started. Works, but I need to get the user who is currently logged in, and of course Environment.UserName returns the service logon...
0
by: dmihailescu | last post by:
the P/Invoke SetWindowLong failed with 'Access is denied' when invoked from a windows service. The service runs under the System account with the 'allow user to interact with the desktop' checked....
2
by: =?Utf-8?B?bXVyYWRqYW1lcw==?= | last post by:
Yes, sorry I tried to make it clear in the original question that I want to get the user token of the service - ie. the account the service is running under. I know services don't have user tokens...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...

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.