473,378 Members | 1,106 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

web app that can interact with other applications on the server

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
10 2480
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
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
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
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
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
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
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
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
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
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

125
by: Sarah Tanembaum | last post by:
Beside its an opensource and supported by community, what's the fundamental differences between PostgreSQL and those high-price commercial database (and some are bloated such as Oracle) from...
1
by: jrefactors | last post by:
how client-side presentation code interact with server-side filter/sort processing code? I have a html table that has sorting and filter capabilities. The sorting and filter features are done...
4
by: ThunderMusic | last post by:
Hi, I created a service application. This service, can possibly start other applications or display message boxes, so it needs to interact with the desktop. The question is the following : How can...
0
by: wbfk | last post by:
Hi, How so I interact with another applications (3rd party apps) Ie... Enter text to some other application textbox Thank you. Fabio
6
by: Ian Frawley | last post by:
Hello everyone I have written a Windows Service to monitor local and remote Processes/Applications. However I am stuck because if it is installed as a user account I cannot get it to interact...
1
by: lltaylor | last post by:
Hello, Does anyone know if windows controls can interact with web controls or vice versa. For example, I would like to have a web page with a Windows Tree Control embedded, and use that...
5
by: billie | last post by:
Hi all. I would like to know if there's some python framework able to interact with system command prompt (cmd.exe or /bin/sh, depending on the system) from python. I need something that supports...
4
by: fabrice | last post by:
Hello I m working with Framework 1.1. I d like to interact with word files (.doc or .dot) from the server. But Neither office or word are installed on it. There is a way for manipulating word...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.