Solved

Problem with Impersonate on a web service

Posted on 2009-06-30
6
360 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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 

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

Suggested Solutions

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

813 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

16 Experts available now in Live!

Get 1:1 Help Now