Solved

Problem with Impersonate on a web service

Posted on 2009-06-30
6
358 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

896 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now