We have PCs out on the Manufacturing floor that have public access and are
always logged in using a public/global profile.
Whenever someone needs to access sensitive information, we want to verify
they have permission by checking their username/password on our Active
Directory server.
How should I authenticate our users using a local Active Directory server? I
have tried the code below, but it returned a COMException 0x80005000 "Unknown
error":
Code:
public static bool Authenticate(st ring domain, string userName, string
passWord) {
string path = string.Format(" LDAP://{0}", domain);
string domUser = domain + @"\" + userName;
DirectoryEntry entry = new DirectoryEntry( string.Format(" LDAP://{0}",
path), domUser, passWord);
entry.Authentic ationType = AuthenticationT ypes.ServerBind ;
try {
object nativeObj = entry.NativeObj ect;
Console.WriteLi ne(string.Forma t("Username '{0}' Authenticated",
userName));
return true;
} catch (COMException e) {
MessageBox.Show (string.Format( "Username '{0}' Not Authenticated:\ n{1}",
userName, e.Message));
} catch (Exception e) {
MessageBox.Show (string.Format( "Username '{0}' Not Authenticated:\ n{1}",
userName, e.Message));
}
return false;
}
Could someone offer a suggestion? I tried Googling, but most solutions
appear to be tailored for ASP.NET - we are only using WinForms.
Is ServerBind incorrect?
Whenever I bring up the Windows Login information (CTRL-ALT-DEL), I can see
that my personal username is "ACPINC\cp-jpool" - and this is what I send in
along with my password using the path LDAP://ACPINC", but it does not work.
Our "Know-It-All" System Administrator ...doesn't! He has nearly completed
his extensive 6-month training at one of the prestigious online websites, so
asking him produced me the useless "I don't know" answer.
Could someone offer a suggestion? 1 5231
Ok, I'm an idiot. I fixed it.
I formatted the path originally, but it wasn't working so I had moved the
path outside of the initialization for the DirectoryEntry. The only thing I
forgot was to remove the "string.For mat" section whenever I was doing my
"cut-n-paste."
If anyone sees any other problems with my code, please feel free to point
them out.
Regards, and thanks for putting up with my slow brain this morning!
~Joe
"jp2msft" wrote:
We have PCs out on the Manufacturing floor that have public access and are
always logged in using a public/global profile.
Whenever someone needs to access sensitive information, we want to verify
they have permission by checking their username/password on our Active
Directory server.
How should I authenticate our users using a local Active Directory server? I
have tried the code below, but it returned a COMException 0x80005000 "Unknown
error":
Code:
public static bool Authenticate(st ring domain, string userName, string
passWord) {
string path = string.Format(" LDAP://{0}", domain);
string domUser = domain + @"\" + userName;
DirectoryEntry entry = new DirectoryEntry( string.Format(" LDAP://{0}",
path), domUser, passWord);
entry.Authentic ationType = AuthenticationT ypes.ServerBind ;
try {
object nativeObj = entry.NativeObj ect;
Console.WriteLi ne(string.Forma t("Username '{0}' Authenticated",
userName));
return true;
} catch (COMException e) {
MessageBox.Show (string.Format( "Username '{0}' Not Authenticated:\ n{1}",
userName, e.Message));
} catch (Exception e) {
MessageBox.Show (string.Format( "Username '{0}' Not Authenticated:\ n{1}",
userName, e.Message));
}
return false;
}
Could someone offer a suggestion? I tried Googling, but most solutions
appear to be tailored for ASP.NET - we are only using WinForms.
Is ServerBind incorrect?
Whenever I bring up the Windows Login information (CTRL-ALT-DEL), I can see
that my personal username is "ACPINC\cp-jpool" - and this is what I send in
along with my password using the path LDAP://ACPINC", but it does not work.
Our "Know-It-All" System Administrator ...doesn't! He has nearly completed
his extensive 6-month training at one of the prestigious online websites, so
asking him produced me the useless "I don't know" answer.
Could someone offer a suggestion?
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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
|
by: bob |
last post by:
Hi,
Is this the right place to dicuss Visual Studio 2005 and .Net 2?
I am try to implement a class (already using Windows Authentication) where I
am given a user name and I return a list of groups to which the user is a
member.
In .Net 1.1, I can use the System.DirectoryServices.ActiveDirectory
namespace; but what do I use in .Net 2?
|
by: Sargas Atum |
last post by:
Hi all,
I am trying to get the field "lastLogon" out of ActiveDirectory.
It should be trivial I thought, but it is not, as I have experienced.
private DataRow FillDataRow( DataRow dataRow, PropertyValueCollection
property , string columnName )
{
if( columnName.Equals("Last Login") && property.Value != null )
|
by: mrwoopey |
last post by:
Hi,
I am using the example "Authenticate against the Active Directory by
Using Forms Authentication and Visual Basic .NET":
http://support.microsoft.com/default.aspx?scid=KB;EN-US;326340
But I am having a problem figuring out the LDAP://
The LDAP:// that I pass looks like this (i substitued generic the
|
by: Greg Burns |
last post by:
I have built a web app that uses forms authentication. There isn't a
"remember me" feature (i.e. the authentication cookie is not permanent).
When you close the browser, and open a new one, you must log in again. This
is the behavior I expected.
I just discovered that if I have a browser window open (to anything) prior
to opening my web app in a new browser window, it appears to share session
information. I can then open and close my...
| |
by: dhnriverside |
last post by:
Hi guys
I want to find out which of my ActiveDirectory users is logged on to a
particular ActiveDirectory Computer.
I can get what Computer a user is logged on to with
Dns.Resolve(Request.ServerVariables).HostName;
But I want to create a list of the computers on the network, with whos
|
by: Nandagopal |
last post by:
Hi,
I am using the example "Authenticate against the Active Directory by
Using Forms Authentication and C#":
But I am having a problem figuring out the LDAP://
The LDAP:// that I pass looks like this (i substitued generic the
following with generic name):
|
by: richardaz |
last post by:
I have been working on a project to search for 250,000 different
records in ActiveDirectory. The process takes a long time and I have
tried everything to make it faster. Currently using
System.DirectoryServices, the calls to the server to search for one
record is currently taking 2-3 seconds. I tried to throw these
requests in the ThreadPool, but was having locking issues on the call
to:
DirectorySearcher.FindOne();
|
by: myth0s |
last post by:
Hi,
The question:
Is it possible to have two differents ActiveDirectory Membership Provider in web.config and change at run-time from the default provider to the second provider if the first one fail?
Context:
We are using the ActiveDirectory Membership Provider as part of our authentication solution. It is working great most of the time, but every now and then the AD process on the main server fail.
With Windows this is not a...
|
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 usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |