Solved

Problem with Impersonate on a web service

Posted on 2009-06-30
6
357 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
Comment Utility
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
Comment Utility
Also try without giving password, username and domain if your imperosnate user has rights to create process.
0
 

Author Comment

by:MisterT25
Comment Utility
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:MisterT25
Comment Utility
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
Comment Utility
is it required any input for process?
0
 

Author Closing Comment

by:MisterT25
Comment Utility
Thank you for the help.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

743 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