473,396 Members | 1,834 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,396 software developers and data experts.

Run Application (EXE) from ASP.Net C#

Task: run application from ASP.NET

for example,
you have a button on ASP.NET page, when press this button - one
application is invoked.
the code to run application (for example, notepad) is (on C#)

System.Diagnostics.Process.Start("notepad");

but the problem is that the application doesn't run, i.e. no window is
opened.

Note that ASP.NET code is executed on the SERVER.

Solution:

ASPNET user under which application is run should have appropriate
security settings.

1. change local policies for APSNET user:
in WinXP: run secpol.msc

go to Local Policies->User Rights Assignment
find "Deny log on locally" and remove ASPNET user from it.

then find "Deny logon locally" and remove ASPNET user from it.
2. Security for files.
if your application needs also to work with files (open, save, etc)
you have to change security settings for the folders to allow user
ASPNET modify nedeed files.
To test how it works without starting ASP.NET site you can try run in
Windows command line:

runas /user:ASPNET "notepad.exe"

it asks you for the password of ASPNET user. enter the password.
if everything is done correct you will see opened application (notepad
in our example) in new window.

More read here:

http://mxdev.blogspot.com/2008/09/as...om-aspnet.html
Sep 2 '08 #1
7 11720
Of course, the application will run on the server, and will present no user
interface to the user who clicked the button.

--
John Saunders | MVP - Connected System Developer

Sep 2 '08 #2
From a standpoint of doing something, this is cool. From a standpoint of
hardening a server, my mind is about to explode, as you are opening up for
severe security breaches when you opt for this method of opening an
application on a web server.

If you must run a process, you are better to wrap the process call in a
service, as you remove the direct conduit from ASP.NET to the app. This is
not as big a deal if you are running notepad (not sure why someone would do
that through ASP.NET on a server, but it is not too risky), but can be a big
deal with some processes.

Imagine if you left a direct pipe to cmd.exe. Wow!

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://feeds.feedburner.com/GregoryBeamer#

or just read it:
http://feeds.feedburner.com/GregoryBeamer

********************************************
| Think outside the box! |
********************************************
<mx*****@gmail.comwrote in message
news:b6**********************************@25g2000h sx.googlegroups.com...
Task: run application from ASP.NET

for example,
you have a button on ASP.NET page, when press this button - one
application is invoked.
the code to run application (for example, notepad) is (on C#)

System.Diagnostics.Process.Start("notepad");

but the problem is that the application doesn't run, i.e. no window is
opened.

Note that ASP.NET code is executed on the SERVER.

Solution:

ASPNET user under which application is run should have appropriate
security settings.

1. change local policies for APSNET user:
in WinXP: run secpol.msc

go to Local Policies->User Rights Assignment
find "Deny log on locally" and remove ASPNET user from it.

then find "Deny logon locally" and remove ASPNET user from it.
2. Security for files.
if your application needs also to work with files (open, save, etc)
you have to change security settings for the folders to allow user
ASPNET modify nedeed files.
To test how it works without starting ASP.NET site you can try run in
Windows command line:

runas /user:ASPNET "notepad.exe"

it asks you for the password of ASPNET user. enter the password.
if everything is done correct you will see opened application (notepad
in our example) in new window.

More read here:

http://mxdev.blogspot.com/2008/09/as...om-aspnet.html
Sep 2 '08 #3
actually its worse. to get notepad (or any non-console app) to run, you need
to enable Interact with desktop. this then means an exe can popup a modal
dialog box (often an error message), on the console, and hang the server
until someone answers the dialog.

-- bruce (sqlwork.com)
"Cowboy (Gregory A. Beamer)" wrote:
From a standpoint of doing something, this is cool. From a standpoint of
hardening a server, my mind is about to explode, as you are opening up for
severe security breaches when you opt for this method of opening an
application on a web server.

If you must run a process, you are better to wrap the process call in a
service, as you remove the direct conduit from ASP.NET to the app. This is
not as big a deal if you are running notepad (not sure why someone would do
that through ASP.NET on a server, but it is not too risky), but can be a big
deal with some processes.

Imagine if you left a direct pipe to cmd.exe. Wow!

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://feeds.feedburner.com/GregoryBeamer#

or just read it:
http://feeds.feedburner.com/GregoryBeamer

********************************************
| Think outside the box! |
********************************************
<mx*****@gmail.comwrote in message
news:b6**********************************@25g2000h sx.googlegroups.com...
Task: run application from ASP.NET

for example,
you have a button on ASP.NET page, when press this button - one
application is invoked.
the code to run application (for example, notepad) is (on C#)

System.Diagnostics.Process.Start("notepad");

but the problem is that the application doesn't run, i.e. no window is
opened.

Note that ASP.NET code is executed on the SERVER.

Solution:

ASPNET user under which application is run should have appropriate
security settings.

1. change local policies for APSNET user:
in WinXP: run secpol.msc

go to Local Policies->User Rights Assignment
find "Deny log on locally" and remove ASPNET user from it.

then find "Deny logon locally" and remove ASPNET user from it.
2. Security for files.
if your application needs also to work with files (open, save, etc)
you have to change security settings for the folders to allow user
ASPNET modify nedeed files.
To test how it works without starting ASP.NET site you can try run in
Windows command line:

runas /user:ASPNET "notepad.exe"

it asks you for the password of ASPNET user. enter the password.
if everything is done correct you will see opened application (notepad
in our example) in new window.

More read here:

http://mxdev.blogspot.com/2008/09/as...om-aspnet.html

Sep 2 '08 #4
I also should have had MUST in capital letters, as I am certainly not
condoning kludging your way around a problem and service wrapping an app
just so you can pop up notepad. :-)

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://feeds.feedburner.com/GregoryBeamer#

or just read it:
http://feeds.feedburner.com/GregoryBeamer

********************************************
| Think outside the box! |
********************************************
"bruce barker" <br*********@discussions.microsoft.comwrote in message
news:2F**********************************@microsof t.com...
actually its worse. to get notepad (or any non-console app) to run, you
need
to enable Interact with desktop. this then means an exe can popup a modal
dialog box (often an error message), on the console, and hang the server
until someone answers the dialog.

-- bruce (sqlwork.com)
"Cowboy (Gregory A. Beamer)" wrote:
>From a standpoint of doing something, this is cool. From a standpoint of
hardening a server, my mind is about to explode, as you are opening up
for
severe security breaches when you opt for this method of opening an
application on a web server.

If you must run a process, you are better to wrap the process call in a
service, as you remove the direct conduit from ASP.NET to the app. This
is
not as big a deal if you are running notepad (not sure why someone would
do
that through ASP.NET on a server, but it is not too risky), but can be a
big
deal with some processes.

Imagine if you left a direct pipe to cmd.exe. Wow!

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://feeds.feedburner.com/GregoryBeamer#

or just read it:
http://feeds.feedburner.com/GregoryBeamer

********************************************
| Think outside the box! |
********************************************
<mx*****@gmail.comwrote in message
news:b6**********************************@25g2000 hsx.googlegroups.com...
Task: run application from ASP.NET

for example,
you have a button on ASP.NET page, when press this button - one
application is invoked.
the code to run application (for example, notepad) is (on C#)

System.Diagnostics.Process.Start("notepad");

but the problem is that the application doesn't run, i.e. no window is
opened.

Note that ASP.NET code is executed on the SERVER.

Solution:

ASPNET user under which application is run should have appropriate
security settings.

1. change local policies for APSNET user:
in WinXP: run secpol.msc

go to Local Policies->User Rights Assignment
find "Deny log on locally" and remove ASPNET user from it.

then find "Deny logon locally" and remove ASPNET user from it.
2. Security for files.
if your application needs also to work with files (open, save, etc)
you have to change security settings for the folders to allow user
ASPNET modify nedeed files.
To test how it works without starting ASP.NET site you can try run in
Windows command line:

runas /user:ASPNET "notepad.exe"

it asks you for the password of ASPNET user. enter the password.
if everything is done correct you will see opened application (notepad
in our example) in new window.

More read here:

http://mxdev.blogspot.com/2008/09/as...om-aspnet.html

Sep 3 '08 #5
as i see - it is not anought to allow Interaction with Desktop

the only solution i found - change Locally Policies to allow ASPNET user or
NetworkService (depending on IIS5 or IIS6) to logon locally

try to run
runas /user:ASPNET "notepad"

it will not open notepad in window..


"bruce barker" wrote:
actually its worse. to get notepad (or any non-console app) to run, you need
to enable Interact with desktop. this then means an exe can popup a modal
dialog box (often an error message), on the console, and hang the server
until someone answers the dialog.

-- bruce (sqlwork.com)
Sep 3 '08 #6
sometimes you need to run application on server side.

i had this task:
when you click button on ASP.NET page - Photoshop application should be
opened and process some image files..

when Photoshop runs hidden (no window, just process in process list) - it
does nothing.

until i changed security settings for ASPNET user.

"Cowboy (Gregory A. Beamer)" wrote:
From a standpoint of doing something, this is cool. From a standpoint of
hardening a server, my mind is about to explode, as you are opening up for
severe security breaches when you opt for this method of opening an
application on a web server.

If you must run a process, you are better to wrap the process call in a
service, as you remove the direct conduit from ASP.NET to the app. This is
not as big a deal if you are running notepad (not sure why someone would do
that through ASP.NET on a server, but it is not too risky), but can be a big
deal with some processes.

Imagine if you left a direct pipe to cmd.exe. Wow!

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://feeds.feedburner.com/GregoryBeamer#

or just read it:
http://feeds.feedburner.com/GregoryBeamer

********************************************
| Think outside the box! |
********************************************
<mx*****@gmail.comwrote in message
news:b6**********************************@25g2000h sx.googlegroups.com...
Task: run application from ASP.NET

for example,
you have a button on ASP.NET page, when press this button - one
application is invoked.
the code to run application (for example, notepad) is (on C#)

System.Diagnostics.Process.Start("notepad");

but the problem is that the application doesn't run, i.e. no window is
opened.

Note that ASP.NET code is executed on the SERVER.

Solution:

ASPNET user under which application is run should have appropriate
security settings.

1. change local policies for APSNET user:
in WinXP: run secpol.msc

go to Local Policies->User Rights Assignment
find "Deny log on locally" and remove ASPNET user from it.

then find "Deny logon locally" and remove ASPNET user from it.
2. Security for files.
if your application needs also to work with files (open, save, etc)
you have to change security settings for the folders to allow user
ASPNET modify nedeed files.
To test how it works without starting ASP.NET site you can try run in
Windows command line:

runas /user:ASPNET "notepad.exe"

it asks you for the password of ASPNET user. enter the password.
if everything is done correct you will see opened application (notepad
in our example) in new window.

More read here:

http://mxdev.blogspot.com/2008/09/as...om-aspnet.html

Sep 3 '08 #7
re:
!change Local Policies to allow ASPNET user to logon locally
!until i changed security settings for ASPNET user.

....which is not recommended.


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
"mxdev, MCDBA, MCPD, MCITP, MCP" <mx********************@discussions.microsoft.comw rote in message
news:F6**********************************@microsof t.com...
sometimes you need to run application on server side.

i had this task:
when you click button on ASP.NET page - Photoshop application should be
opened and process some image files..

when Photoshop runs hidden (no window, just process in process list) - it
does nothing.

until i changed security settings for ASPNET user.

"Cowboy (Gregory A. Beamer)" wrote:
>From a standpoint of doing something, this is cool. From a standpoint of
hardening a server, my mind is about to explode, as you are opening up for
severe security breaches when you opt for this method of opening an
application on a web server.

If you must run a process, you are better to wrap the process call in a
service, as you remove the direct conduit from ASP.NET to the app. This is
not as big a deal if you are running notepad (not sure why someone would do
that through ASP.NET on a server, but it is not too risky), but can be a big
deal with some processes.

Imagine if you left a direct pipe to cmd.exe. Wow!

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://feeds.feedburner.com/GregoryBeamer#

or just read it:
http://feeds.feedburner.com/GregoryBeamer

********************************************
| Think outside the box! |
********************************************
<mx*****@gmail.comwrote in message
news:b6**********************************@25g2000 hsx.googlegroups.com...
Task: run application from ASP.NET

for example,
you have a button on ASP.NET page, when press this button - one
application is invoked.
the code to run application (for example, notepad) is (on C#)

System.Diagnostics.Process.Start("notepad");

but the problem is that the application doesn't run, i.e. no window is
opened.

Note that ASP.NET code is executed on the SERVER.

Solution:

ASPNET user under which application is run should have appropriate
security settings.

1. change local policies for APSNET user:
in WinXP: run secpol.msc

go to Local Policies->User Rights Assignment
find "Deny log on locally" and remove ASPNET user from it.

then find "Deny logon locally" and remove ASPNET user from it.
2. Security for files.
if your application needs also to work with files (open, save, etc)
you have to change security settings for the folders to allow user
ASPNET modify nedeed files.
To test how it works without starting ASP.NET site you can try run in
Windows command line:

runas /user:ASPNET "notepad.exe"

it asks you for the password of ASPNET user. enter the password.
if everything is done correct you will see opened application (notepad
in our example) in new window.

More read here:

http://mxdev.blogspot.com/2008/09/as...om-aspnet.html


Sep 3 '08 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Nick | last post by:
Hi, I would like to make my application to automatically check on updates from a source and if any, downloads it and automatically updates itself with the new version. Now because the...
10
by: gregory_may | last post by:
I have an application I created called "JpegViewer.exe". It simply loads a Jpeg file and displays in on the screen. It works great, in my lab. When I am using it at a customer site, things...
3
by: Mustaq | last post by:
Hi, How to read same config file from different application? I have 4 application in VB.NET, all are using different app.config files. NOW I need all to read only one config file, how can I do...
0
by: Rhon Stewart via DotNetMonster.com | last post by:
Hi please visit this link : http://www.eggheadcafe.com/articles/pfc/selfupdater.asp I followed all the steps for listed on the link , when I execute the application it it gives me the following...
4
by: bob lambert | last post by:
Help I am trying to deploy to another pc a vb.net std 2002 windows form application. I am confused. I created a project - windows form I built form, compiled and debugged. I created a...
6
by: yaron | last post by:
Hi all, I want to give a sample console application for the user with 2 configuration files. I want to give also a 2 .bat files for running the sample application, one for each configuration...
1
by: Arne Adams | last post by:
Hi, I try to use a C# Dialog in a legacy MFC application. The problem seems to boil down to the following: from an unmanaged console application I can call any function of the managed bridge - if...
2
by: =?Utf-8?B?Vmlua2k=?= | last post by:
Hello Everyone, I have an exe application that I want to start remotely.Once I start the application, I want to press ok to that application. To start the application, I did...
0
by: Tifer | last post by:
Hello, I am building my first .Net Application. The first couple of Publish and Installs I did went fine. But after a couple of builds, I get a modal dialogue box error every time upon trying...
1
by: abhijitbkulkarni | last post by:
Hello, I am designing a .NET database application that uses 3 tier architecture. Starting initially, this application will be desktop application but I will convert it into a website later but...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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...
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.