473,480 Members | 2,379 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

ServiceControl Permissions

I seem to be getting an error saying I can't control services from an aspx page.
This code works:

private void Page_Load(object sender, System.EventArgs e)
{
/* Global Settings */
pcanywhereControl = new ServiceController("pcAnywhere Host Service");

/* put a title on the page */
TitleLabel.Text = pcanywhereControl.DisplayName.ToString();

StatusLabel.Text = pcanywhereControl.Status.ToString();

if (pcanywhereControl.Status.ToString() == "Running")
{
StartButton.Enabled = false;
}
else
{
StartButton.Enabled = true;
}
}
however, this code gives the following message:

"Cannot open awhost32 service on computer '.'."

private void Page_Load(object sender, System.EventArgs e)
{
/* Global Settings */
pcanywhereControl = new ServiceController("pcAnywhere Host Service");

/* put a title on the page */
TitleLabel.Text = pcanywhereControl.DisplayName.ToString();

StatusLabel.Text = pcanywhereControl.Status.ToString();

if (pcanywhereControl.Status.ToString() == "Running")
{
StartButton.Enabled = false;
}
else
{
StartButton.Enabled = true;
}
}
I need to be able to do this without running the asp.net user as
an administrator.

____________________________________
Wil Moore III, MCP | Integrations Specialist | Senior Consultant
DigitallySmooth Inc. | Quick Site Studio
Nov 18 '05 #1
2 2749
Depending on your environment, you might be able to use impersonation
and allow your code to run in the security context of the requestor.

See http://support.microsoft.com/default...b;en-us;317012
and http://support.microsoft.com/default...;en-us;Q306158
for more info.

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

On Wed, 28 Jan 2004 01:06:53 -0800, "Laidbak" <la*******@hotmail.com>
wrote:
I seem to be getting an error saying I can't control services from an aspx page.
This code works:

private void Page_Load(object sender, System.EventArgs e)
{
/* Global Settings */
pcanywhereControl = new ServiceController("pcAnywhere Host Service");

/* put a title on the page */
TitleLabel.Text = pcanywhereControl.DisplayName.ToString();

StatusLabel.Text = pcanywhereControl.Status.ToString();

if (pcanywhereControl.Status.ToString() == "Running")
{
StartButton.Enabled = false;
}
else
{
StartButton.Enabled = true;
}
}
however, this code gives the following message:

"Cannot open awhost32 service on computer '.'."

private void Page_Load(object sender, System.EventArgs e)
{
/* Global Settings */
pcanywhereControl = new ServiceController("pcAnywhere Host Service");

/* put a title on the page */
TitleLabel.Text = pcanywhereControl.DisplayName.ToString();

StatusLabel.Text = pcanywhereControl.Status.ToString();

if (pcanywhereControl.Status.ToString() == "Running")
{
StartButton.Enabled = false;
}
else
{
StartButton.Enabled = true;
}
}
I need to be able to do this without running the asp.net user as
an administrator.

____________________________________
Wil Moore III, MCP | Integrations Specialist | Senior Consultant
DigitallySmooth Inc. | Quick Site Studio


Nov 18 '05 #2
Good show...
I added the following line to the app's web.config

<identity impersonate="true"/>

I then made sure "Integrated Windows Authentication"
was checked under directory security.

All is well.
____________________________________
Wil Moore III, MCP | Integrations Specialist | Senior Consultant
DigitallySmooth Inc. | Quick Site Studio
"Scott Allen" <bitmask@[nospam].fred.net> wrote in message news:du********************************@4ax.com...
Depending on your environment, you might be able to use impersonation
and allow your code to run in the security context of the requestor.

See http://support.microsoft.com/default...b;en-us;317012
and http://support.microsoft.com/default...;en-us;Q306158
for more info.

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

On Wed, 28 Jan 2004 01:06:53 -0800, "Laidbak" <la*******@hotmail.com>
wrote:
I seem to be getting an error saying I can't control services from an aspx page.
This code works:

private void Page_Load(object sender, System.EventArgs e)
{
/* Global Settings */
pcanywhereControl = new ServiceController("pcAnywhere Host Service");

/* put a title on the page */
TitleLabel.Text = pcanywhereControl.DisplayName.ToString();

StatusLabel.Text = pcanywhereControl.Status.ToString();

if (pcanywhereControl.Status.ToString() == "Running")
{
StartButton.Enabled = false;
}
else
{
StartButton.Enabled = true;
}
}
however, this code gives the following message:

"Cannot open awhost32 service on computer '.'."

private void Page_Load(object sender, System.EventArgs e)
{
/* Global Settings */
pcanywhereControl = new ServiceController("pcAnywhere Host Service");

/* put a title on the page */
TitleLabel.Text = pcanywhereControl.DisplayName.ToString();

StatusLabel.Text = pcanywhereControl.Status.ToString();

if (pcanywhereControl.Status.ToString() == "Running")
{
StartButton.Enabled = false;
}
else
{
StartButton.Enabled = true;
}
}
I need to be able to do this without running the asp.net user as
an administrator.

____________________________________
Wil Moore III, MCP | Integrations Specialist | Senior Consultant
DigitallySmooth Inc. | Quick Site Studio


Nov 18 '05 #3

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

Similar topics

7
2543
by: Kim Lots | last post by:
Hi Sorry to disturb you again but i really like to know what's the NTFS folder permissions on a "virtual directory" folder for a public webserver iis 5.x running ASP 3.0 with an Access DB on a...
1
3053
by: Brad H McCollum | last post by:
I'm writing an application using VB 6.0 as the front-end GUI, and the MSDE version of SQL Server as the back-end (it's a program for a really small # of users --- less then 3-4). I'm trying to...
6
2254
by: !!! Klutzo !!! | last post by:
I give permissions for ASPNET on a top level subdirectory. A windows program copies a file into the subdirectory, however, my web service cannot access the file because it does not have...
2
4332
by: Jozef | last post by:
Hello, Is there a way to change table permissions in VB Code? I can't seem to find much that's concise in the help file. Here's the situation; I have a table in the "data" portion of a split...
7
476
by: none | last post by:
Hello: I had a nice php application running on my server here at home, and I uploaded it to a shared public type server and it started to break all over the place. It turns out that some...
3
1600
by: Alex Maghen | last post by:
Hi. I am really confused about the NTFS permissions that I must set for my ASP.NET 2.0 IIS application to work properly. I have looked at KB:815153 and that helps a *little* bit, but I need...
13
1678
by: MLH | last post by:
Invalid qualifier error displays at compile time on this A97 example from Permissions Property HELP. What's wrong with the strContainerName assignment line? (6th line) Sub...
0
1334
by: Curt K | last post by:
We run some web services (IIS 5 and IIS 6) that communicate to a COM out of process server, which in turn communicates to another out of process COM server (long story). We have had lots of...
8
7687
by: jporter188 | last post by:
Hello, I am working on a project to manipulate XML files. All of the files, the code, and the output are on network drives. When I run my program I get an exception (see below). I tried giving...
6
3239
by: DotNetNewbie | last post by:
Hello, in my web application, I have to create permissions for each user. So what I am doing is that for each role (using sqlmembership in .net) I am creating a column in the database to hold a...
0
7051
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
6915
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
7054
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
7097
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...
1
6750
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
6993
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...
0
4493
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
2993
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1307
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 ...

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.