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

Windows Service Authorization

Hello

I need to run this type of code in my windows Service:
///////////////////////////////////////////////////////////////////////////////
Protected Overrides Sub OnStart(ByVal args() As String)

If User= "Administrator" Then
'do code
Else
'do nothing
End If

End
/////////////////////////////////////////////////////////////////////////////////
Can I check who is logged in to the computer with help of service?

When I try to:
/////////////////////////////////////////////////////////////////////////////////
If My.User.IsInRole(ApplicationServices.BuiltInRole.A dministrator) Then
or
If My.User.CurrentPrincipal.Identity.Name = "Administrator" Then
//////////////////////////////////////////////////////////////////////////////
It does't work (goes directly to 'Else)..

Best Regards

Oct 2 '06 #1
1 1528

"matisq" <ma*****@tlen.plwrote in message
news:11**********************@m73g2000cwd.googlegr oups.com...
Hello

I need to run this type of code in my windows Service:
///////////////////////////////////////////////////////////////////////////////
Protected Overrides Sub OnStart(ByVal args() As String)

If User= "Administrator" Then
'do code
Else
'do nothing
End If

End
/////////////////////////////////////////////////////////////////////////////////
Can I check who is logged in to the computer with help of service?

When I try to:
/////////////////////////////////////////////////////////////////////////////////
If My.User.IsInRole(ApplicationServices.BuiltInRole.A dministrator) Then
or
If My.User.CurrentPrincipal.Identity.Name = "Administrator" Then
//////////////////////////////////////////////////////////////////////////////
It does't work (goes directly to 'Else)..
Environment.UserName? Your service may need to be set to allow interaction
with the desktop though. Also, check what your service logs on as - it might
be "LocalSystem" or similar.
Oct 3 '06 #2

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

Similar topics

1
by: srivalli chavali via DotNetMonster.com | last post by:
Hi, I have a question regd. Windows authentication and network file access. My asp.net application doesn't use any of the .NET's authentication schemes (Forms, Windows or Passport) yet. I have...
20
by: Moty Michaely | last post by:
Hello, Can anyone please help me finding a good way to develop a c# winforms application client for a pre-developed windows service? Should I use wse2 with tcp protocol? Bu I still have win98...
4
by: Jose | last post by:
Hello all I've a problem, I need to develop a component to connect a web service for sending SMS. The web service it's not implemented in .NET.I need to use basic authentication (at least that...
5
by: pberna | last post by:
Dear all, I built a Web Form application to start and stop a Windows Service remotely. I successful tested the application on Windows 2000 server + IIS. I must include the ASPNET user to the...
1
by: Manuel Brandao | last post by:
Hi all I would like to now the answer to the following problem, if someone can help. Given a windows application client that's calling a web service (using default credentials) the web...
2
by: Ottavio | last post by:
Hello, I'm having some problems with the authentication during a web service call I know I have to add the "Authorization: Basic xxxxxxxx" in the http header (not soap header) but I can't find a...
3
by: Goran Djuranovic | last post by:
Hi all, I have a web app running on a local PC that can start and stop windows service on a remote machine, but only when I browse to it locally. If I browse to it from my other PC and try to...
3
by: Enda Manni | last post by:
Hi, I have a gSoap Web Service written using C++, it uses SOAP username and password authentication. I also have a C# form client consuming the web service, all this was working fine until...
0
by: donet programmer | last post by:
I have created web service application in .net 2.0 with IIS set to disable anonymous access and use windows integrated authentication. My web.config is set as below <authentication...
5
by: Max2006 | last post by:
Hi, I am trying to limit my wcf service endpoint to response to only given windows user or group. How can I do that? Is there any way to configure that in the .config file? Thank you, Max
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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.