By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,888 Members | 1,236 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,888 IT Pros & Developers. It's quick & easy.

Spawning exe under different user name not working

P: n/a
Hi,

I have a little .exe file that I want the C# code behind of my web
application to execute as a different user. The executable is supposed
to take a screenshot of the server's display and save the image and it
has to be run under the currently logged on user otherwise the
generated image just turns out black.

My problem is when I click the button on the browser thats supposed to
run the exe file a message box appears on the server saying that the
file failed to initialise properly:

The application failed to initialize properly (0xc0000142). Click on OK
to terminate the application.

That's the exact error message I'm getting with no other details. I've
tried giving the ASP account on the server full permissions with no
luck. The user account that is currently logged on, which is the user
account the exe is supposed to run under has full permissions as well.

What I'm using is ASP.Net2.0 and the new ProcessStartInfo.UserName and
ProcessStartInfo.Password arguments to run the exe under a different
user account.

If anyone has any alternative solutions on how to get this done or know
any way to fix this please let me know.

Thanks!

Kris

Nov 19 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
You are trying to execute an EXE on the Client?
Good luck. Seriously though, the only way you are going to be able to do
this is to either cripple the security on the client or have them install a
Component of some sort.
If you need a screenshot of the client you will have to ask the client to do
this and then upload it... you cant really automate this.

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

"kr**********@yahoo.com" wrote:
Hi,

I have a little .exe file that I want the C# code behind of my web
application to execute as a different user. The executable is supposed
to take a screenshot of the server's display and save the image and it
has to be run under the currently logged on user otherwise the
generated image just turns out black.

My problem is when I click the button on the browser thats supposed to
run the exe file a message box appears on the server saying that the
file failed to initialise properly:

The application failed to initialize properly (0xc0000142). Click on OK
to terminate the application.

That's the exact error message I'm getting with no other details. I've
tried giving the ASP account on the server full permissions with no
luck. The user account that is currently logged on, which is the user
account the exe is supposed to run under has full permissions as well.

What I'm using is ASP.Net2.0 and the new ProcessStartInfo.UserName and
ProcessStartInfo.Password arguments to run the exe under a different
user account.

If anyone has any alternative solutions on how to get this done or know
any way to fix this please let me know.

Thanks!

Kris

Nov 19 '05 #2

P: n/a
kr**********@yahoo.com wrote:
Hi,

I have a little .exe file that I want the C# code behind of my web
application to execute as a different user. The executable is supposed
to take a screenshot of the server's display and save the image and it
has to be run under the currently logged on user otherwise the
generated image just turns out black.

My problem is when I click the button on the browser thats supposed to
run the exe file a message box appears on the server saying that the
file failed to initialise properly:

The application failed to initialize properly (0xc0000142). Click on OK
to terminate the application.

That's the exact error message I'm getting with no other details. I've
tried giving the ASP account on the server full permissions with no
luck. The user account that is currently logged on, which is the user
account the exe is supposed to run under has full permissions as well.

What I'm using is ASP.Net2.0 and the new ProcessStartInfo.UserName and
ProcessStartInfo.Password arguments to run the exe under a different
user account.

If anyone has any alternative solutions on how to get this done or know
any way to fix this please let me know.

Hmm. Unfortunately, that error is kindof generic, and may not help us
much with diagnosis. A route I might take in attempting to do this
would be to create a "Snapshot" service that is permanently running,
and has an open socket. When the website wants to cause the snapshot,
it connects to the socket and instructs the service to perform the
snapshot (possibly passing parameters such as a destination filename,
etc). This also allows the possibility that the service can decide on
snapshot names and pass the data back.

The socket approach may not be necessary - it's possible to use other
techniques/technologies to achieve the same aims - For instance, I've
not done anything yet with Remoting, but I believe that it would be a
possibility.

A final note - be VERY careful with this. Have you fully considered the
security implications of allowing any random person who connects to
your site being allowed to snapshot the current users desktop (and view
the resulting image?)

Damien

Nov 19 '05 #3

P: n/a
No no no! The exe is executed on the server. The client just clicks a
button on the webform to start the program on the server. I tried to be
as clear as possible but again what im trying to do is this:

An executable file on the server is supposed to capture the screen of
the server.
The executable file is launched from c# code of the web application.
(which is stored on the server)
All the client does is access the web page and click a button that
tells the c# code to execute this file on the server.

There i hope thats a bit clearer. And the problem I am having with this
is that when the exe is run (on the server) it immedialtely crashes and
displays the above error message (on the server).

Nov 19 '05 #4

P: n/a
Thanks Damien, the thought of having a service that listens for socket
connections and takes screenshots on command on the server has crossed
my mind and I'm thinking of saving that for last if nothing else works.

As for security the web application has a login page so only authorized
users will be able to get images of the server's display and the web
app will be running on the company intranet.

Kris

Nov 19 '05 #5

P: n/a
Thanks Damien, the tought of running a service that listens for socket
connections and takes screen captures has crossed my mind but I want to
save that for last if all else fails.

Also the web app will be running on the company intranet and will have
a login page to only allow authorized users to access this.

Kris

Nov 19 '05 #6

P: n/a
you problem is that any process spawned by asp.net (or any service) does not
have access to the desktop, so it can not snapshot the screen.

the best approach is to create a nt service, and setup the service
permission to allow access to the desktop (requires running the sevice as
local systemn account and checking interact with desktop in service
properties). then use remoting from the asp.net page to call the service.

-- bruce (sqlwork.com)
<kr**********@yahoo.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
Hi,

I have a little .exe file that I want the C# code behind of my web
application to execute as a different user. The executable is supposed
to take a screenshot of the server's display and save the image and it
has to be run under the currently logged on user otherwise the
generated image just turns out black.

My problem is when I click the button on the browser thats supposed to
run the exe file a message box appears on the server saying that the
file failed to initialise properly:

The application failed to initialize properly (0xc0000142). Click on OK
to terminate the application.

That's the exact error message I'm getting with no other details. I've
tried giving the ASP account on the server full permissions with no
luck. The user account that is currently logged on, which is the user
account the exe is supposed to run under has full permissions as well.

What I'm using is ASP.Net2.0 and the new ProcessStartInfo.UserName and
ProcessStartInfo.Password arguments to run the exe under a different
user account.

If anyone has any alternative solutions on how to get this done or know
any way to fix this please let me know.

Thanks!

Kris

Nov 19 '05 #7

P: n/a
Yeah I just found that out the long way.. i changed the user the asp
worker process runs under to the logged on user.. the application I'm
trying to spawn runs but doesn't have access to the desktop. Spawning
an application or running code on the server that sends a print screen
keypress doesn't seem to work as well. I guess I'll just make a service
to do this for me.

Thanks guys!

Kris

Nov 19 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.