473,545 Members | 2,291 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ASP.NET, C#, Process.GetProc esses

Hi,

I have made some simple ASP.NET (C#) application, that somewhere uses this
command:

Process [] aProcesses = Process.GetProc esses(Environme nt.MachineName) ;

This command purpose is to find some proccess on local machine and do
something. This works perfect on the machine (XP) where I have been
developing this app!

But then, when I copied my application on some other machine (Win2k), it
reports the error on this line, saying:

System.Componen tModel.Win32Exc eption: Access is denied

This is really strange, because it seems to grab the proccesses from the
remote machine (what is totally wrong, this should list the proccesses from
local machine). And the code is just copied from XP where this works fine.

Please if anybody can help me out with this...
Thanks,

/Denis
Nov 16 '05 #1
7 6844
Hi,

Maybe it's the permission of the user under which the ASP.net process is
running.

Change it to an user with admin rights and see what happens

REMEMBER to change it back later !!!
cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Denis Brkljacic" <de***********@ nospam.hr> wrote in message
news:cv******** **@fegnews.vip. hr...
Hi,

I have made some simple ASP.NET (C#) application, that somewhere uses this
command:

Process [] aProcesses = Process.GetProc esses(Environme nt.MachineName) ;

This command purpose is to find some proccess on local machine and do
something. This works perfect on the machine (XP) where I have been
developing this app!

But then, when I copied my application on some other machine (Win2k), it
reports the error on this line, saying:

System.Componen tModel.Win32Exc eption: Access is denied

This is really strange, because it seems to grab the proccesses from the
remote machine (what is totally wrong, this should list the proccesses
from
local machine). And the code is just copied from XP where this works fine.

Please if anybody can help me out with this...
Thanks,

/Denis

Nov 16 '05 #2
Your parameter is incorrect. If you need processes running on the local
machine, you need to simply do a getprocess() and store the results in an
array. This is most likely the cause of the permissions error you are
experiencing since you do not have access to the remote process.

--
Regards
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
--------------------------------------------------
"Ignacio Machin ( .NET/ C# MVP )" <ignacio.mach in AT dot.state.fl.us > wrote
in message news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
Hi,

Maybe it's the permission of the user under which the ASP.net process is
running.

Change it to an user with admin rights and see what happens

REMEMBER to change it back later !!!
cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Denis Brkljacic" <de***********@ nospam.hr> wrote in message
news:cv******** **@fegnews.vip. hr...
Hi,

I have made some simple ASP.NET (C#) application, that somewhere uses
this
command:

Process [] aProcesses = Process.GetProc esses(Environme nt.MachineName) ;

This command purpose is to find some proccess on local machine and do
something. This works perfect on the machine (XP) where I have been
developing this app!

But then, when I copied my application on some other machine (Win2k), it
reports the error on this line, saying:

System.Componen tModel.Win32Exc eption: Access is denied

This is really strange, because it seems to grab the proccesses from the
remote machine (what is totally wrong, this should list the proccesses
from
local machine). And the code is just copied from XP where this works
fine.

Please if anybody can help me out with this...
Thanks,

/Denis


Nov 16 '05 #3
Thanks, but I have already tried this: Process [] aProcesses = Process.
GetProcesses();

The same thing, this works fine on the 'original' machine (XP), but when
copied to another one (win2k), I get access denied, trying to get processes
from 'remote machine'.

I have switched impersonation on and gave full rights to aspnet user, but
still no success... :(

Regards,

/Denis
Sun, 27 Feb 2005 01:05:29 +0200
----- Original Message -----
From: "Alvin Bruney [Microsoft MVP]" <www.lulu.com/owc> Sent: Sun, 27 Feb
2005 01:33:02 Subject: Re: ASP.NET, C#, Process.GetProc esses
Your parameter is incorrect. If you need processes running on the local
machine, you need to simply do a getprocess() and store the results in an
array. This is most likely the cause of the permissions error you are
experiencing since you do not have access to the remote process.

--
Regards
Alvin Bruney
[Shameless Author Plug] The Microsoft Office Web Components Black Book
with .NET available at www.lulu.com/owc
--------------------------------------------------
"Ignacio Machin ( .NET/ C# MVP )" <ignacio.mach in AT dot.state.fl.us > wrote
in message news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
Hi, Maybe it's the permission of the user under which the ASP.net process is
running. Change it to an user with admin rights and see what happens REMEMBER to change it back later !!!
cheers, --
Ignacio Machin,
ignacio.machin AT dot.state.fl.us Florida Department Of Transportation

"Denis Brkljacic" <de***********@ nospam.hr> wrote in message news:
cv**********@fe gnews.vip.hr...
Hi, I have made some simple ASP.NET (C#) application, that somewhere uses
this
command: Process [] aProcesses = Process.GetProc esses(Environme nt.MachineName) ; This command purpose is to find some proccess on local machine and do
something. This works perfect on the machine (XP) where I have been
developing this app! But then, when I copied my application on some other machine (Win2k),
it reports the error on this line, saying: System.Componen tModel.Win32Exc eption: Access is denied This is really strange, because it seems to grab the proccesses from
the remote machine (what is totally wrong, this should list the
proccesses from
local machine). And the code is just copied from XP where this works
fine. Please if anybody can help me out with this...
Thanks, /Denis

Nov 16 '05 #4
This doesn't make sense. You obviously are doing something wrong because the
getprocess call should be running on the LOCAL machine not a remote machine.

Have a look at the help docs on the proper call. Finally, when you get the
call working, you will need to setup proper access rights. The webpage needs
to run under the correct account (u said you impersonate) but you still need
separate permissions for the process to request the info from the OS.

So you have 3 issues to deal with - one is getting the call configured
correctly, the other two has to deal with the aspnet worker process rights
and the machine rights to invoke the call.

--
Regards
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
--------------------------------------------------
"Denis" <de**********@v ip.hr> wrote in message
news:11******** @denisdbAbC01.v ip.hr...
Thanks, but I have already tried this: Process [] aProcesses = Process.
GetProcesses();

The same thing, this works fine on the 'original' machine (XP), but when
copied to another one (win2k), I get access denied, trying to get
processes
from 'remote machine'.

I have switched impersonation on and gave full rights to aspnet user, but
still no success... :(

Regards,

/Denis
Sun, 27 Feb 2005 01:05:29 +0200
----- Original Message -----
From: "Alvin Bruney [Microsoft MVP]" <www.lulu.com/owc> Sent: Sun, 27 Feb
2005 01:33:02 Subject: Re: ASP.NET, C#, Process.GetProc esses
Your parameter is incorrect. If you need processes running on the local
machine, you need to simply do a getprocess() and store the results in an
array. This is most likely the cause of the permissions error you are
experiencing since you do not have access to the remote process.

--
Regards
Alvin Bruney
[Shameless Author Plug] The Microsoft Office Web Components Black Book
with .NET available at www.lulu.com/owc
--------------------------------------------------
"Ignacio Machin ( .NET/ C# MVP )" <ignacio.mach in AT dot.state.fl.us >
wrote
in message news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
Hi,

Maybe it's the permission of the user under which the ASP.net process is
running.

Change it to an user with admin rights and see what happens

REMEMBER to change it back later !!!


cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us Florida Department Of Transportation

"Denis Brkljacic" <de***********@ nospam.hr> wrote in message news:
cv**********@fe gnews.vip.hr...
Hi, I have made some simple ASP.NET (C#) application, that somewhere uses
this
command: Process [] aProcesses = Process.GetProc esses(Environme nt.MachineName) ; This command purpose is to find some proccess on local machine and do
something. This works perfect on the machine (XP) where I have been
developing this app! But then, when I copied my application on some other machine (Win2k),
it reports the error on this line, saying: System.Componen tModel.Win32Exc eption: Access is denied This is really strange, because it seems to grab the proccesses from
the remote machine (what is totally wrong, this should list the
proccesses from
local machine). And the code is just copied from XP where this works
fine. Please if anybody can help me out with this...
Thanks, /Denis

Nov 16 '05 #5
Ok, thanks, I'll try that...
/Denis
"Alvin Bruney [Microsoft MVP]" <www.lulu.com/owc> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
This doesn't make sense. You obviously are doing something wrong because
the getprocess call should be running on the LOCAL machine not a remote
machine.

Have a look at the help docs on the proper call. Finally, when you get the
call working, you will need to setup proper access rights. The webpage
needs to run under the correct account (u said you impersonate) but you
still need separate permissions for the process to request the info from
the OS.

So you have 3 issues to deal with - one is getting the call configured
correctly, the other two has to deal with the aspnet worker process rights
and the machine rights to invoke the call.

--
Regards
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
--------------------------------------------------
"Denis" <de**********@v ip.hr> wrote in message
news:11******** @denisdbAbC01.v ip.hr...
Thanks, but I have already tried this: Process [] aProcesses = Process.
GetProcesses();

The same thing, this works fine on the 'original' machine (XP), but when
copied to another one (win2k), I get access denied, trying to get
processes
from 'remote machine'.

I have switched impersonation on and gave full rights to aspnet user, but
still no success... :(

Regards,

/Denis
Sun, 27 Feb 2005 01:05:29 +0200
----- Original Message -----
From: "Alvin Bruney [Microsoft MVP]" <www.lulu.com/owc> Sent: Sun, 27 Feb
2005 01:33:02 Subject: Re: ASP.NET, C#, Process.GetProc esses
Your parameter is incorrect. If you need processes running on the local
machine, you need to simply do a getprocess() and store the results in an
array. This is most likely the cause of the permissions error you are
experiencing since you do not have access to the remote process.

--
Regards
Alvin Bruney
[Shameless Author Plug] The Microsoft Office Web Components Black Book
with .NET available at www.lulu.com/owc
--------------------------------------------------
"Ignacio Machin ( .NET/ C# MVP )" <ignacio.mach in AT dot.state.fl.us >
wrote
in message news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
> Hi,

> Maybe it's the permission of the user under which the ASP.net process
> is
> running.

> Change it to an user with admin rights and see what happens

> REMEMBER to change it back later !!!


> cheers,

> --
> Ignacio Machin,
> ignacio.machin AT dot.state.fl.us Florida Department Of Transportation

> "Denis Brkljacic" <de***********@ nospam.hr> wrote in message news:
> cv**********@fe gnews.vip.hr...
>> Hi,

>> I have made some simple ASP.NET (C#) application, that somewhere uses
>> this
>> command:

>> Process [] aProcesses = Process.GetProc esses(Environme nt.MachineName) ;

>> This command purpose is to find some proccess on local machine and do
>> something. This works perfect on the machine (XP) where I have been
>> developing this app!

>> But then, when I copied my application on some other machine (Win2k),
>> it reports the error on this line, saying:

>> System.Componen tModel.Win32Exc eption: Access is denied

>> This is really strange, because it seems to grab the proccesses from
>> the remote machine (what is totally wrong, this should list the
>> proccesses from
>> local machine). And the code is just copied from XP where this works
>> fine.

>> Please if anybody can help me out with this...


>> Thanks,

>> /Denis


Nov 16 '05 #6
That means Environment.Mac hineName is returning a remote machine machine
name, which is impossible.
Your problem is a security privilege issue. The asp.net process identity is
missing the right security privileges to get the process list.
You should impersonate an administrator or run your asp.net process as an
administrator, or much better, run this piece of code in a server type COM+
(EnterpriseServ ices) application with identity set to an administrator's
account.

Willy.
"Denis Brkljacic" <de***********@ nospam.hr> wrote in message
news:cv******** **@fegnews.vip. hr...
Hi,

I have made some simple ASP.NET (C#) application, that somewhere uses this
command:

Process [] aProcesses = Process.GetProc esses(Environme nt.MachineName) ;

This command purpose is to find some proccess on local machine and do
something. This works perfect on the machine (XP) where I have been
developing this app!

But then, when I copied my application on some other machine (Win2k), it
reports the error on this line, saying:

System.Componen tModel.Win32Exc eption: Access is denied

This is really strange, because it seems to grab the proccesses from the
remote machine (what is totally wrong, this should list the proccesses
from
local machine). And the code is just copied from XP where this works fine.

Please if anybody can help me out with this...
Thanks,

/Denis

Nov 16 '05 #7
You can also try boosting the asp.net account to "System" for testing
purposes in the machine config. You would need to return it back to its
least priviledge account as it represents a significant security risk.

--
Regards
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
--------------------------------------------------
"Willy Denoyette [MVP]" <wi************ *@pandora.be> wrote in message
news:ev******** ******@TK2MSFTN GP12.phx.gbl...
That means Environment.Mac hineName is returning a remote machine machine
name, which is impossible.
Your problem is a security privilege issue. The asp.net process identity
is missing the right security privileges to get the process list.
You should impersonate an administrator or run your asp.net process as an
administrator, or much better, run this piece of code in a server type
COM+ (EnterpriseServ ices) application with identity set to an
administrator's account.

Willy.
"Denis Brkljacic" <de***********@ nospam.hr> wrote in message
news:cv******** **@fegnews.vip. hr...
Hi,

I have made some simple ASP.NET (C#) application, that somewhere uses
this
command:

Process [] aProcesses = Process.GetProc esses(Environme nt.MachineName) ;

This command purpose is to find some proccess on local machine and do
something. This works perfect on the machine (XP) where I have been
developing this app!

But then, when I copied my application on some other machine (Win2k), it
reports the error on this line, saying:

System.Componen tModel.Win32Exc eption: Access is denied

This is really strange, because it seems to grab the proccesses from the
remote machine (what is totally wrong, this should list the proccesses
from
local machine). And the code is just copied from XP where this works
fine.

Please if anybody can help me out with this...
Thanks,

/Denis


Nov 16 '05 #8

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

Similar topics

5
6875
by: Jane | last post by:
Hi, I try Process remoteByName = Process.GetProcesses(); it works but when I try Process remoteByName = Process.GetProcesses("localhost"); it fails with invalid operation please Help me! Threre is no way to find help on the internet, i am desesperate. ../Jane
2
1182
by: alvis | last post by:
hi i have a windows service that uses an excell workbook when i create the excell app i cant distroy it after i am finished i am using this code whats wrong? thanks Dim processes1(), p1 As Process Try processes1 = Process.GetProcesses() For Each p1 In processes1
1
2736
by: Roger | last post by:
When looking through the list created by the System.Diagnositc.Process.GetProcesses and verifying it with the Task Manager Process list. There are items in the Task Manager Process list that are not showing up on the vb.net System.Diagnositc.Process.GetProcesses list? Why would this happen?
7
4749
by: Gamma | last post by:
I'm trying to create a ListBox that holds list of currently running processes. So I inherited from Process a classes named _Process, which it's objects are to be held in the ListBox (I just overrode the "ToString"). Using the "GetProcesses" method, I get Process, that I want to cast to _Process. So why do I get "System.InvalidCastException"...
1
8402
by: Chris | last post by:
Hello, I have a Windows Forms application which has buttons to click to run other programs. One of the applications it must run is a ClickOnce Windows Forms application, so the Application Reference in the start menu is the only way to access it. I have the following code used to start the other program:
4
10512
by: =?Utf-8?B?Q2hyaXM=?= | last post by:
I know I can use this code to start a process. Any aimilar way to end one? System.Diagnostics.Process.Start("EcpKpScript_01.exe");
3
440
by: =?Utf-8?B?Q2hyaXM=?= | last post by:
I am using the following code to see if a process is currently running. I want to do something if it is NOT running. I am having trouble testing the array when no process is runing. Null won't work. Any ideas? // is process currently running in case someone closed it manually Process myProcesses; // Returns array containing all instances of...
0
1506
by: 5000wpm | last post by:
"couldn't get process information from remote machine" - Access denied Using VS2003 VB.NET 1.1 under Windows XP Pro x64. Hi, Having recently upgraded to Windows XP Pro x64 a problem has developed in my code. I have boiled this problem down into smaller and smaller apps until I am at this point:
5
1799
by: ags5406 | last post by:
I've a Windows Service that keeps a particular executable running. If the executable fails for whatever reason, the Service restarts it. Right now I'm using a loop to check if the process is running. I started with an infinite loop that ate up all of my resources, but then added a 2 second pause after every check, which seems to have mostly...
0
7465
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7398
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7656
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7752
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5325
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3449
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3441
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1878
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
701
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.