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

web app that can interact with other applications on the server

P: n/a
I want to make a web application that will run on my home server and would
like to be able to have the web application interact with another, winforms
application. For example, let's say I wanted to go to an aspx page, click a
button called "open notepad", then on ther server machine I would like to
have the web app interact with a service installed on my server that handles
the execution of different files.

Does that makes sense?
Nov 19 '05 #1
Share this Question
Share on Google+
10 Replies


P: n/a
I tried executing a shell command, no luck

private void Button1_Click(object sender, System.EventArgs e)
{
// open notepad
try
{
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.EnableRaisingEvents=false;
proc.StartInfo.FileName="notepad";
proc.Start();
Response.Write("Process started...");
}
catch(Exception exception)
{
Response.Write(exception.ToString());
}

}

Hmmm... there must be a way to do this somehow.. anyone have an idea?

"Steve" <ss*@sss.com> wrote in message
news:Ol**************@tk2msftngp13.phx.gbl...
I want to make a web application that will run on my home server and would
like to be able to have the web application interact with another, winforms application. For example, let's say I wanted to go to an aspx page, click a button called "open notepad", then on ther server machine I would like to
have the web app interact with a service installed on my server that handles the execution of different files.

Does that makes sense?

Nov 19 '05 #2

P: n/a
I have it wrapped in a try block, there are no exceptions. The result of
Start() is true.
This is weird, it just does nothing....

I have change the Virtual Directory "Execute Permissions" to "Scripts and
Executables"
"Steve" <ss*@sss.com> wrote in message
news:Ol**************@tk2msftngp13.phx.gbl...
I want to make a web application that will run on my home server and would
like to be able to have the web application interact with another, winforms application. For example, let's say I wanted to go to an aspx page, click a button called "open notepad", then on ther server machine I would like to
have the web app interact with a service installed on my server that handles the execution of different files.

Does that makes sense?

Nov 19 '05 #3

P: n/a
it works, notepad.exe just exits right away with an error because it cannot
create a window. only commandline apps can be run from a webserver

-- bruce (sqlwork.com)


"Steve" <ss*@sss.com> wrote in message
news:uM**************@TK2MSFTNGP10.phx.gbl...
I have it wrapped in a try block, there are no exceptions. The result of
Start() is true.
This is weird, it just does nothing....

I have change the Virtual Directory "Execute Permissions" to "Scripts and
Executables"
"Steve" <ss*@sss.com> wrote in message
news:Ol**************@tk2msftngp13.phx.gbl...
I want to make a web application that will run on my home server and
would
like to be able to have the web application interact with another,

winforms
application. For example, let's say I wanted to go to an aspx page,
click

a
button called "open notepad", then on ther server machine I would like to
have the web app interact with a service installed on my server that

handles
the execution of different files.

Does that makes sense?


Nov 19 '05 #4

P: n/a
wow, I have never tried so many different things and had so little effect.
I've given execute permissions to IUSR_<machine name>
I've tried all different kinds of code snips...

The process starts.. I can see it in task manager on the process tab.. but I
can't "see" it, the window never opens. I have tried:
proc.StartInfo.WindowStyle =
System.Diagnostics.ProcessWindowStyle.Maximized;
This is nuts.. no error, no exception... nothing.

"Steve" <ss*@sss.com> wrote in message
news:Ol**************@tk2msftngp13.phx.gbl...
I want to make a web application that will run on my home server and would
like to be able to have the web application interact with another, winforms application. For example, let's say I wanted to go to an aspx page, click a button called "open notepad", then on ther server machine I would like to
have the web app interact with a service installed on my server that handles the execution of different files.

Does that makes sense?

Nov 19 '05 #5

P: n/a
the process is still listed in the process list after I kill the asp
process. It seems to still be alive and well, eating memory and all.
I added: <identity impersonate="true" />
to my web config, and now an exception is being thrown:
System.ComponentModel.Win32Exception: Access is denied at
System.Diagnostics.Process.StartWithCreateProcess( ProcessStartInfo
startInfo) at System.Diagnostics.Process.Start()

I'm surprised that I can't configure the webserver to launch a new process,
any process I want and configure on the web server. I could see if I was
trying to launch a process on the client or something crazy like that, but
on the webserver?

Thanks for the response ;)

"Bruce Barker" <br******************@safeco.com> wrote in message
news:eO**************@tk2msftngp13.phx.gbl...
it works, notepad.exe just exits right away with an error because it cannot create a window. only commandline apps can be run from a webserver

-- bruce (sqlwork.com)


"Steve" <ss*@sss.com> wrote in message
news:uM**************@TK2MSFTNGP10.phx.gbl...
I have it wrapped in a try block, there are no exceptions. The result of
Start() is true.
This is weird, it just does nothing....

I have change the Virtual Directory "Execute Permissions" to "Scripts and Executables"
"Steve" <ss*@sss.com> wrote in message
news:Ol**************@tk2msftngp13.phx.gbl...
I want to make a web application that will run on my home server and
would
like to be able to have the web application interact with another,

winforms
application. For example, let's say I wanted to go to an aspx page,
click

a
button called "open notepad", then on ther server machine I would like to have the web app interact with a service installed on my server that

handles
the execution of different files.

Does that makes sense?



Nov 19 '05 #6

P: n/a
Hi Steve:

Windows has the concept of a windows station. A windows station
contains a desktop. A desktop contains windows [lower case w], a
clipboard, and all those UI and infrastructure pieces we think of as
being a part of Windows.

You can have multiple active winstations. There are two types of win
stations - interactive and non-interacitive. When you log onto a
machine you get an interactive winstation that sends information to a
real display device and takes input from the mouse and keyboard.

Services like IIS and the ASP.NET worker process it spawns are
designed to not interact with a user. They typically start before
anyone is logged into a machine, and stay running after everyone logs
out. Windows gives services a non-interactive windows station. There
is no way to make a non-interactive station an interactive station.

When you start a program from a service, the program starts in the
same winstation that the service is in. When you start Notepad - it is
in an invisible, non-interactive winstation you'll never see.

You can PInvoke CreateProcess and ask windows to put the process into
the interactive winstation, but winstations are also security
boundaries and the ASP.NET worker process will need a lot of
priviledge to do this.

Launching visible GUI applications on a server from ASP.NET is not
something you want to do.

--
Scott
http://www.OdeToCode.com/blogs/scott/
On Tue, 12 Jul 2005 16:16:31 -0700, "Steve" <ss*@sss.com> wrote:
wow, I have never tried so many different things and had so little effect.
I've given execute permissions to IUSR_<machine name>
I've tried all different kinds of code snips...

The process starts.. I can see it in task manager on the process tab.. but I
can't "see" it, the window never opens. I have tried:
proc.StartInfo.WindowStyle =
System.Diagnostics.ProcessWindowStyle.Maximized ;
This is nuts.. no error, no exception... nothing.

"Steve" <ss*@sss.com> wrote in message
news:Ol**************@tk2msftngp13.phx.gbl...
I want to make a web application that will run on my home server and would
like to be able to have the web application interact with another,

winforms
application. For example, let's say I wanted to go to an aspx page, click

a
button called "open notepad", then on ther server machine I would like to
have the web app interact with a service installed on my server that

handles
the execution of different files.

Does that makes sense?


Nov 19 '05 #7

P: n/a
Wow Scott, that is an awesome explanation, thanks for taking the time!

Basically, I have a webcam at home so I can watch my dogs from work(they
aren't used to being left alone) and I thought it would be neat if I could
play different MP3s of mine or my girlfriends voice so that we could see
them move ;)

Silly? yes. Kinda weird? yes.

So my idea of executing mp3 files with Process.Start() isn't going to work.
It sounds like I will need to use the pInvoke (not sure what that is yet)
method. I imagine that any RPC or remoting stuff would suffer from the same
interactive/non-interactive domains you mention. The same with getting a
handle on say a winamp.exe process and passing it a filename.

I will read up on PInvoke. Thanks again for the post.
"Scott Allen" <sc***@nospam.odetocode.com> wrote in message
news:a0********************************@4ax.com...
Hi Steve:

Windows has the concept of a windows station. A windows station
contains a desktop. A desktop contains windows [lower case w], a
clipboard, and all those UI and infrastructure pieces we think of as
being a part of Windows.

You can have multiple active winstations. There are two types of win
stations - interactive and non-interacitive. When you log onto a
machine you get an interactive winstation that sends information to a
real display device and takes input from the mouse and keyboard.

Services like IIS and the ASP.NET worker process it spawns are
designed to not interact with a user. They typically start before
anyone is logged into a machine, and stay running after everyone logs
out. Windows gives services a non-interactive windows station. There
is no way to make a non-interactive station an interactive station.

When you start a program from a service, the program starts in the
same winstation that the service is in. When you start Notepad - it is
in an invisible, non-interactive winstation you'll never see.

You can PInvoke CreateProcess and ask windows to put the process into
the interactive winstation, but winstations are also security
boundaries and the ASP.NET worker process will need a lot of
priviledge to do this.

Launching visible GUI applications on a server from ASP.NET is not
something you want to do.

--
Scott
http://www.OdeToCode.com/blogs/scott/
On Tue, 12 Jul 2005 16:16:31 -0700, "Steve" <ss*@sss.com> wrote:
wow, I have never tried so many different things and had so little effect.I've given execute permissions to IUSR_<machine name>
I've tried all different kinds of code snips...

The process starts.. I can see it in task manager on the process tab.. but Ican't "see" it, the window never opens. I have tried:
proc.StartInfo.WindowStyle =
System.Diagnostics.ProcessWindowStyle.Maximized ;
This is nuts.. no error, no exception... nothing.

"Steve" <ss*@sss.com> wrote in message
news:Ol**************@tk2msftngp13.phx.gbl...
I want to make a web application that will run on my home server and would like to be able to have the web application interact with another,

winforms
application. For example, let's say I wanted to go to an aspx page, click
a
button called "open notepad", then on ther server machine I would like

to have the web app interact with a service installed on my server that

handles
the execution of different files.

Does that makes sense?

Nov 19 '05 #8

P: n/a
On Wed, 13 Jul 2005 10:30:32 -0700, "Steve" <ss*@sss.com> wrote:
Wow Scott, that is an awesome explanation, thanks for taking the time!

Basically, I have a webcam at home so I can watch my dogs from work(they
aren't used to being left alone) and I thought it would be neat if I could
play different MP3s of mine or my girlfriends voice so that we could see
them move ;)

Silly? yes. Kinda weird? yes.

So my idea of executing mp3 files with Process.Start() isn't going to work.
It sounds like I will need to use the pInvoke (not sure what that is yet)
method. I imagine that any RPC or remoting stuff would suffer from the same
interactive/non-interactive domains you mention. The same with getting a
handle on say a winamp.exe process and passing it a filename.

I will read up on PInvoke. Thanks again for the post.


Ah, well, if this is for fun then let's find a solution!!

You could use remoting to communicate between ASP.NET and a program
running on your desktop - that's not a bad idea.

Another idea would be to have the Aspx page write a file into a
specific directory. Perhaps the file contains some parameters in XML.
Then have a program that runs on your home desktop and monitors the
directory for a new file (use System.IO.FileSystemWatcher). The
program could read the parameters from the file and execute whatever
command you need.

Just be very careful about taking input from the web and ultimately
sending it to another program that executes other programs. You
wouldn't want the unscrupulous type to find your web server and
somehow have it execute "format c:".

--
Scott
http://www.OdeToCode.com/blogs/scott/

Nov 19 '05 #9

P: n/a
Your File system solution is clever, I like that!
However, remoting seems the cleanest and safest. I will look into this and
let you know what I find out. Thanks again for the response, I have renewed
hope ;)
"Scott Allen" <sc***@nospam.odetocode.com> wrote in message
news:ir********************************@4ax.com...
On Wed, 13 Jul 2005 10:30:32 -0700, "Steve" <ss*@sss.com> wrote:
Wow Scott, that is an awesome explanation, thanks for taking the time!

Basically, I have a webcam at home so I can watch my dogs from work(they
aren't used to being left alone) and I thought it would be neat if I couldplay different MP3s of mine or my girlfriends voice so that we could see
them move ;)

Silly? yes. Kinda weird? yes.

So my idea of executing mp3 files with Process.Start() isn't going to work.It sounds like I will need to use the pInvoke (not sure what that is yet)
method. I imagine that any RPC or remoting stuff would suffer from the sameinteractive/non-interactive domains you mention. The same with getting a
handle on say a winamp.exe process and passing it a filename.

I will read up on PInvoke. Thanks again for the post.


Ah, well, if this is for fun then let's find a solution!!

You could use remoting to communicate between ASP.NET and a program
running on your desktop - that's not a bad idea.

Another idea would be to have the Aspx page write a file into a
specific directory. Perhaps the file contains some parameters in XML.
Then have a program that runs on your home desktop and monitors the
directory for a new file (use System.IO.FileSystemWatcher). The
program could read the parameters from the file and execute whatever
command you need.

Just be very careful about taking input from the web and ultimately
sending it to another program that executes other programs. You
wouldn't want the unscrupulous type to find your web server and
somehow have it execute "format c:".

--
Scott
http://www.OdeToCode.com/blogs/scott/

Nov 19 '05 #10

P: n/a
"Scott Allen" <sc***@nospam.odetocode.com> wrote in message
news:ir********************************@4ax.com...
On Wed, 13 Jul 2005 10:30:32 -0700, "Steve" <ss*@sss.com> wrote:
Wow Scott, that is an awesome explanation, thanks for taking the time!

Basically, I have a webcam at home so I can watch my dogs from work(they
aren't used to being left alone) and I thought it would be neat if I couldplay different MP3s of mine or my girlfriends voice so that we could see
them move ;)

Silly? yes. Kinda weird? yes.

So my idea of executing mp3 files with Process.Start() isn't going to work.It sounds like I will need to use the pInvoke (not sure what that is yet)
method. I imagine that any RPC or remoting stuff would suffer from the sameinteractive/non-interactive domains you mention. The same with getting a
handle on say a winamp.exe process and passing it a filename.

I will read up on PInvoke. Thanks again for the post.


Ah, well, if this is for fun then let's find a solution!!

You could use remoting to communicate between ASP.NET and a program
running on your desktop - that's not a bad idea.

Another idea would be to have the Aspx page write a file into a
specific directory. Perhaps the file contains some parameters in XML.
Then have a program that runs on your home desktop and monitors the
directory for a new file (use System.IO.FileSystemWatcher). The
program could read the parameters from the file and execute whatever
command you need.

Just be very careful about taking input from the web and ultimately
sending it to another program that executes other programs. You
wouldn't want the unscrupulous type to find your web server and
somehow have it execute "format c:".

--
Scott
http://www.OdeToCode.com/blogs/scott/

wow, this sounds perfect

" The Task Server can take any object that implements the simple ITask
interface, and run it within its own Application Domain. What's more, it can
accept tasks from multiple clients at one time. "
http://www.csharphelp.com/archives/archive187.html
Nov 19 '05 #11

This discussion thread is closed

Replies have been disabled for this discussion.