Solved

Problem with Impersonate on a web service

Posted on 2009-06-30
6
361 Views
Last Modified: 2012-05-07
I have a working web service.  When data is received I would like to run an external program against this data.  I have setup impersonation to use a known-working username and password, but the program does not run.

Thanks for any ideas.
If impersonateValidUser("myuser", "WEST", "mypassword") Then
    '
    Dim proc As New Process
    proc.StartInfo.Password = New System.Security.SecureString()
    For Each c As Char In "mypassword"
        proc.StartInfo.Password.AppendChar(c)
    Next
    proc.StartInfo.UseShellExecute = False
    proc.StartInfo.Arguments = arg1 & " " & arg2
    proc.StartInfo.FileName = "C:\Program Files\DoMerge\DoMerge.exe"
 
    proc.Start()
 
    undoImpersonation()
 
End If

Open in new window

0
Comment
Question by:MisterT25
  • 3
  • 3
6 Comments
 
LVL 15

Accepted Solution

by:
jinal earned 500 total points
ID: 24751031
did you check that it is going inside if condition.

If impersonateValidUser("myuser", "WEST", "mypassword") Then
    '
    Dim proc As New Process
    proc.StartInfo.Password = New System.Security.SecureString()
    For Each c As Char In "mypassword"
        proc.StartInfo.Password.AppendChar(c)
    Next
    proc.StartInfo.UseShellExecute = False
    proc.StartInfo.Arguments = arg1 & " " & arg2
    proc.StartInfo.FileName = "C:\Program Files\DoMerge\DoMerge.exe"
 
    proc.Start()
    proc.WaitForExit()
    undoImpersonation()
 
End If

I think you are missing to provide UserName and Domain in proc.StartInfo .
0
 
LVL 15

Expert Comment

by:jinal
ID: 24751037
Also try without giving password, username and domain if your imperosnate user has rights to create process.
0
 

Author Comment

by:MisterT25
ID: 24751066
Hi jinal,

Yes, I put a call to an email program in the IF statement, so I know I am using valid credentials.

Thanks
0
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 

Author Comment

by:MisterT25
ID: 24751112
jinal,

I ran the process explorer program, and I can see that the program did start, but it did not run to completion.  It seems hung for some reason.

Thanks
0
 
LVL 15

Expert Comment

by:jinal
ID: 24751546
is it required any input for process?
0
 

Author Closing Comment

by:MisterT25
ID: 31598528
Thank you for the help.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question