473,586 Members | 2,792 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Authenticating against network server using non-domain account

I need to access the scheduler service on a network computer in order to manipulate it remotely from .NET; I have all of the necessary code to perform the manipulation and it works - great - but I am having problems with authentication.

I have tried using LogonUser and this works fine with a domain account, however it is not possible to use this with an account that is defined only on the remote computer - it only works with local or domain accounts.

Any suggestions as to how I can authenticate my connection to the remote PC using a logon and password local to that machine?
Dec 16 '05 #1
10 8287
Martin,

Have you tried using the machine name in the domain parameter?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
"Martin Robins" <martin dot robins at technicaldirect dot co dot uk> wrote in message news:e9******** ******@TK2MSFTN GP14.phx.gbl...
I need to access the scheduler service on a network computer in order to manipulate it remotely from .NET; I have all of the necessary code to perform the manipulation and it works - great - but I am having problems with authentication.

I have tried using LogonUser and this works fine with a domain account, however it is not possible to use this with an account that is defined only on the remote computer - it only works with local or domain accounts.

Any suggestions as to how I can authenticate my connection to the remote PC using a logon and password local to that machine?
Dec 16 '05 #2
I have; it is not accepted.

LogonUser will only work when specifying the local machine name or a domain name that is valid for the local machine as you are effectively logging a new user onto that machine (and of course a local user on another machine would not be able to log onto the local machine).

Cheers.

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> wrote in message news:uf******** ******@TK2MSFTN GP15.phx.gbl...
Martin,

Have you tried using the machine name in the domain parameter?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
"Martin Robins" <martin dot robins at technicaldirect dot co dot uk> wrote in message news:e9******** ******@TK2MSFTN GP14.phx.gbl...
I need to access the scheduler service on a network computer in order to manipulate it remotely from .NET; I have all of the necessary code to perform the manipulation and it works - great - but I am having problems with authentication.

I have tried using LogonUser and this works fine with a domain account, however it is not possible to use this with an account that is defined only on the remote computer - it only works with local or domain accounts.

Any suggestions as to how I can authenticate my connection to the remote PC using a logon and password local to that machine?
Dec 16 '05 #3
P.S. I've looked at
WebConfiguratio nManager.GetWeb Application("sy stem.net/mailSettings");

But I can never get that to return anything and the only example I can find
with it being used is with ConnectionStrin gs.

I would have thought this would have worked.

SmtpSection smtpSec =
WebConfiguratio nManager.GetWeb ApplicationSect ion("mailSettin gs") as
SmtpSection;

Debug.WriteLine (smtpSect.Netwo rk.UserName);

But smtpSec is always null

Dec 16 '05 #4
Not accepted is a little vague isn't it? What is the return code of the LogonUser call? Some code would help also.
LogonUser doesn't "log on", it retuns an access token that can be used to access the remote server, so when you specify the credentials, as valid on a remote server, this server 'security system' returns a token that can be used to access the remote server when "impersonating" .

Willy.

"Martin Robins" <martin dot robins at technicaldirect dot co dot uk> wrote in message news:e7******** ******@TK2MSFTN GP10.phx.gbl...
I have; it is not accepted.

LogonUser will only work when specifying the local machine name or a domain name that is valid for the local machine as you are effectively logging a new user onto that machine (and of course a local user on another machine would not be able to log onto the local machine).

Cheers.

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> wrote in message news:uf******** ******@TK2MSFTN GP15.phx.gbl...
Martin,

Have you tried using the machine name in the domain parameter?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
"Martin Robins" <martin dot robins at technicaldirect dot co dot uk> wrote in message news:e9******** ******@TK2MSFTN GP14.phx.gbl...
I need to access the scheduler service on a network computer in order to manipulate it remotely from .NET; I have all of the necessary code to perform the manipulation and it works - great - but I am having problems with authentication.

I have tried using LogonUser and this works fine with a domain account, however it is not possible to use this with an account that is defined only on the remote computer - it only works with local or domain accounts.

Any suggestions as to how I can authenticate my connection to the remote PC using a logon and password local to that machine?
Dec 16 '05 #5
IntPtr tokenHandle = new IntPtr(0), duplicateTokenH andle = new IntPtr(0);

bool result = advapi32.LogonU ser(userName, domain, password, advapi32.LogonT ype.Interactive , advapi32.LogonP rovider.Default , ref tokenHandle);

LogonType.Inter active = 2, LogonProvider.D efault = 0
Sorry; error code is 1326 - "Logon failure: unknown user name or bad password" even though the details are correct (I created the account specifically).
"Willy Denoyette [MVP]" <wi************ *@telenet.be> wrote in message news:Ox******** ******@TK2MSFTN GP15.phx.gbl...
Not accepted is a little vague isn't it? What is the return code of the LogonUser call? Some code would help also.
LogonUser doesn't "log on", it retuns an access token that can be used to access the remote server, so when you specify the credentials, as valid on a remote server, this server 'security system' returns a token that can be used to access the remote server when "impersonating" .

Willy.

"Martin Robins" <martin dot robins at technicaldirect dot co dot uk> wrote in message news:e7******** ******@TK2MSFTN GP10.phx.gbl...
I have; it is not accepted.

LogonUser will only work when specifying the local machine name or a domain name that is valid for the local machine as you are effectively logging a new user onto that machine (and of course a local user on another machine would not be able to log onto the local machine).

Cheers.

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> wrote in message news:uf******** ******@TK2MSFTN GP15.phx.gbl...
Martin,

Have you tried using the machine name in the domain parameter?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
"Martin Robins" <martin dot robins at technicaldirect dot co dot uk> wrote in message news:e9******** ******@TK2MSFTN GP14.phx.gbl...
I need to access the scheduler service on a network computer in order to manipulate it remotely from .NET; I have all of the necessary code to perform the manipulation and it works - great - but I am having problems with authentication.

I have tried using LogonUser and this works fine with a domain account, however it is not possible to use this with an account that is defined only on the remote computer - it only works with local or domain accounts.

Any suggestions as to how I can authenticate my connection to the remote PC using a logon and password local to that machine?
Dec 16 '05 #6
Have you tried logging in with an account local to the server that has the same username and password as the user on the remote machine and impersonating that instead? My understanding is that this "trick" will work with NTLM in a situation where you can't use domain accounts/Kerberos.

Joe K.

"Martin Robins" <martin dot robins at technicaldirect dot co dot uk> wrote in message news:ey******** ******@TK2MSFTN GP10.phx.gbl...
IntPtr tokenHandle = new IntPtr(0), duplicateTokenH andle = new IntPtr(0);

bool result = advapi32.LogonU ser(userName, domain, password, advapi32.LogonT ype.Interactive , advapi32.LogonP rovider.Default , ref tokenHandle);

LogonType.Inter active = 2, LogonProvider.D efault = 0
Sorry; error code is 1326 - "Logon failure: unknown user name or bad password" even though the details are correct (I created the account specifically).
"Willy Denoyette [MVP]" <wi************ *@telenet.be> wrote in message news:Ox******** ******@TK2MSFTN GP15.phx.gbl...
Not accepted is a little vague isn't it? What is the return code of the LogonUser call? Some code would help also.
LogonUser doesn't "log on", it retuns an access token that can be used to access the remote server, so when you specify the credentials, as valid on a remote server, this server 'security system' returns a token that can be used to access the remote server when "impersonating" .

Willy.

"Martin Robins" <martin dot robins at technicaldirect dot co dot uk> wrote in message news:e7******** ******@TK2MSFTN GP10.phx.gbl...
I have; it is not accepted.

LogonUser will only work when specifying the local machine name or a domain name that is valid for the local machine as you are effectively logging a new user onto that machine (and of course a local user on another machine would not be able to log onto the local machine).

Cheers.

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> wrote in message news:uf******** ******@TK2MSFTN GP15.phx.gbl...
Martin,

Have you tried using the machine name in the domain parameter?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
"Martin Robins" <martin dot robins at technicaldirect dot co dot uk> wrote in message news:e9******** ******@TK2MSFTN GP14.phx.gbl...
I need to access the scheduler service on a network computer in order to manipulate it remotely from .NET; I have all of the necessary code to perform the manipulation and it works - great - but I am having problems with authentication.

I have tried using LogonUser and this works fine with a domain account, however it is not possible to use this with an account that is defined only on the remote computer - it only works with local or domain accounts.

Any suggestions as to how I can authenticate my connection to the remote PC using a logon and password local to that machine?
Dec 16 '05 #7
No, interactive will not work. you need to call LogonUser with LOGON32_LOGON_N EW_CREDENTIALS, this logon type returns an access token that will get used to access the network resource while cloning the access token of the current logon user and use this one to access local resources.
Note that this requires W2K or higher.

Willy.

"Martin Robins" <martin dot robins at technicaldirect dot co dot uk> wrote in message news:ey******** ******@TK2MSFTN GP10.phx.gbl...
IntPtr tokenHandle = new IntPtr(0), duplicateTokenH andle = new IntPtr(0);

bool result = advapi32.LogonU ser(userName, domain, password, advapi32.LogonT ype.Interactive , advapi32.LogonP rovider.Default , ref tokenHandle);

LogonType.Inter active = 2, LogonProvider.D efault = 0
Sorry; error code is 1326 - "Logon failure: unknown user name or bad password" even though the details are correct (I created the account specifically).
"Willy Denoyette [MVP]" <wi************ *@telenet.be> wrote in message news:Ox******** ******@TK2MSFTN GP15.phx.gbl...
Not accepted is a little vague isn't it? What is the return code of the LogonUser call? Some code would help also.
LogonUser doesn't "log on", it retuns an access token that can be used to access the remote server, so when you specify the credentials, as valid on a remote server, this server 'security system' returns a token that can be used to access the remote server when "impersonating" .

Willy.

"Martin Robins" <martin dot robins at technicaldirect dot co dot uk> wrote in message news:e7******** ******@TK2MSFTN GP10.phx.gbl...
I have; it is not accepted.

LogonUser will only work when specifying the local machine name or a domain name that is valid for the local machine as you are effectively logging a new user onto that machine (and of course a local user on another machine would not be able to log onto the local machine).

Cheers.

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> wrote in message news:uf******** ******@TK2MSFTN GP15.phx.gbl...
Martin,

Have you tried using the machine name in the domain parameter?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
"Martin Robins" <martin dot robins at technicaldirect dot co dot uk> wrote in message news:e9******** ******@TK2MSFTN GP14.phx.gbl...
I need to access the scheduler service on a network computer in order to manipulate it remotely from .NET; I have all of the necessary code to perform the manipulation and it works - great - but I am having problems with authentication.

I have tried using LogonUser and this works fine with a domain account, however it is not possible to use this with an account that is defined only on the remote computer - it only works with local or domain accounts.

Any suggestions as to how I can authenticate my connection to the remote PC using a logon and password local to that machine?
Dec 16 '05 #8
Joe,

This should do as well, but is not needed on W2K or higher (needs the kerberos provider). Much better is to use "split token identity", as provided by using LOGON32_LOGON_N EW_CREDENTIALS as logontype.

Willy.

"Joe Kaplan (MVP - ADSI)" <jo************ *@removethis.ac centure.com> wrote in message news:%2******** ********@tk2msf tngp13.phx.gbl. ..
Have you tried logging in with an account local to the server that has the same username and password as the user on the remote machine and impersonating that instead? My understanding is that this "trick" will work with NTLM in a situation where you can't use domain accounts/Kerberos.

Joe K.

"Martin Robins" <martin dot robins at technicaldirect dot co dot uk> wrote in message news:ey******** ******@TK2MSFTN GP10.phx.gbl...
IntPtr tokenHandle = new IntPtr(0), duplicateTokenH andle = new IntPtr(0);

bool result = advapi32.LogonU ser(userName, domain, password, advapi32.LogonT ype.Interactive , advapi32.LogonP rovider.Default , ref tokenHandle);

LogonType.Inter active = 2, LogonProvider.D efault = 0
Sorry; error code is 1326 - "Logon failure: unknown user name or bad password" even though the details are correct (I created the account specifically).
"Willy Denoyette [MVP]" <wi************ *@telenet.be> wrote in message news:Ox******** ******@TK2MSFTN GP15.phx.gbl...
Not accepted is a little vague isn't it? What is the return code of the LogonUser call? Some code would help also.
LogonUser doesn't "log on", it retuns an access token that can be used to access the remote server, so when you specify the credentials, as valid on a remote server, this server 'security system' returns a token that can be used to access the remote server when "impersonating" .

Willy.

"Martin Robins" <martin dot robins at technicaldirect dot co dot uk> wrote in message news:e7******** ******@TK2MSFTN GP10.phx.gbl...
I have; it is not accepted.

LogonUser will only work when specifying the local machine name or a domain name that is valid for the local machine as you are effectively logging a new user onto that machine (and of course a local user on another machine would not be able to log onto the local machine).

Cheers.

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> wrote in message news:uf******** ******@TK2MSFTN GP15.phx.gbl...
Martin,

Have you tried using the machine name in the domain parameter?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
"Martin Robins" <martin dot robins at technicaldirect dot co dot uk> wrote in message news:e9******** ******@TK2MSFTN GP14.phx.gbl...
I need to access the scheduler service on a network computer in order to manipulate it remotely from .NET; I have all of the necessary code to perform the manipulation and it works - great - but I am having problems with authentication.

I have tried using LogonUser and this works fine with a domain account, however it is not possible to use this with an account that is defined only on the remote computer - it only works with local or domain accounts.

Any suggestions as to how I can authenticate my connection to the remote PC using a logon and password local to that machine?
Dec 16 '05 #9
Neato, thanks.

I'm still learning what all those flags do.

Joe K.

"Willy Denoyette [MVP]" <wi************ *@telenet.be> wrote in message news:O%******** **********@TK2M SFTNGP15.phx.gb l...
Joe,

This should do as well, but is not needed on W2K or higher (needs the kerberos provider). Much better is to use "split token identity", as provided by using LOGON32_LOGON_N EW_CREDENTIALS as logontype.

Willy.
Dec 16 '05 #10

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

Similar topics

6
2846
by: Smitro | last post by:
Hi, I'm looking for a Tutorial about Authenticating using PHP and Linux User Accounts. Can some one point me in the right direction? Smitro
3
814
by: Zeno Lee | last post by:
I'm trying to authenticate a user against a windows network. I want it to work across any kind of windows network from NT 4.0 up to Windows 2003 ADS. So far I've been using DirectoryEntry and DirectorySearcher and doing a search on Active Directory. With the addition of a customer on an NT 4.0 network, I've had to add DllImport using...
7
1309
by: Nick Gilbert | last post by:
Hi, As part of a website (ASP.NET) we're creating, we need the ability to store documents with pretty much 'mission critical' security. ie, if the server is completely compromised (eg a trojan/virus is installed or someone physically steals the server) they will still not be able to gain access to the content of the files. I can securely...
1
1287
by: mirlisa | last post by:
We have an odd problem. Sometime this morning our classic asp web application stopped authenticating against active directory. This is our only "classic" asp app that authenticates against ad. Note that this app has been in production for three years with no problems. All .NET apps are authenticating fine from the same server. This same...
1
1250
by: spelunka | last post by:
Hello, does anyone know why one would lose their styles after successfully authenticating against forms auth? I'm using asp.net 2.0 and the page that is being redirected to after authenticating is a content page created from a masterpage.master. Styles are lost on all controls on all content pages not just the main content page. Thanks in...
3
15521
by: Ryan Liu | last post by:
Hi, I use Server: Use an endless thread to lisiten to clients requests: while(true) { TcpClient client = myListener.AcceptTcpClient();
1
4326
by: JohnH | last post by:
Hi, In my application which has two or more threads calling web service or just HttpWebRequest I am seeing some HTTP 400 errors retrun in the response. All the calls are going through the same ISA proxy the connections to which must be authenticated. The 400 error are comming fron the wed server back through the proxy. When I Sniff the...
2
1943
by: Salad | last post by:
If I work on my app on my standalone, things are always fast. If I have an non-split app on the network it runs fast. If I split the app and have both the front end and backend on the network the app's speed drops to a crawl. If I split the app have and make sure the MDBs use file names 8 chars and have a persistent link to the backend...
10
6147
by: gary0gilbert | last post by:
An unusual spin to this recurring disk or network error in a Terminal Server environment. Access 2000, Terminal Server 2000, file server is windows 2000. All users have a separate copy of the front end db, everyone accesses the back-end db via a network share. To preface, non Terminal Server users (4 or 5 in office) never have this problem....
1
20589
by: Ryan Liu | last post by:
Hi, I have a 100 clients/ one server application, use ugly one thread pre client approach. And both side user sync I/O. I frequently see the error on server side(client side code is same, but I don't see the error): "System.IO.IOException: Unable to read data from the transport connection:A blocking operation was interrupted by a call...
0
7836
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
8199
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
8336
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7950
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
1
5710
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
3835
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
3863
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2343
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
1175
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.