.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

LDAP Authentication against SunOne using getdirectoryentry method of directorysearcher object in Asp

Posted By:      Posted Date: September 23, 2010    Points: 0   Category :ASP.Net
Hi All,
I am authenticating user in following way but it says "unknown username or password" even though I provide correct username and password. I am authenticating against Sunone directory server. Unfortunately as per rquirement I could not bind any user with the direcory except service username and password.

I could not figure out whether this correct way or not. Any help would be appreciated.

DirectoryEntry entry = new DirectoryEntry("LDAP URL");

entry.AuthenticationType = AuthenticationTypes.ServerBind;
entry.Username = "uid=thost,ou=somthing,dc=something,dc=something";
entry.Password = password;
DirectorySearcher search = new DirectorySearcher(entry);

search.Filter = "(uid=" + actualUid + ")";
SearchResult rc = search.FindOne();


DirectoryEntry de = rc.GetDirectoryEntry();
de.Password = actualPassword;
object o = de.NativeObject;

catch (Exception ex)

View Complete Post

More Related Resource Links

Thinking about new C# method prototypes: object as dictionary

I recently had to write a small Flickr API. I know many .Net API for Flickr already exist but I needed one for a Silverlight application. Whatever, it's only about building some querystrings so I did it by myself. It's been an opportunity to think again about a classical question: how to pass parameters to a method ?

Imagine you have a generic method to call some Flickr functions.

Jscript error: Object does not support property or method


 Hi, i have little knowledge on javascript but i need to use this code get from somewhere for a jquery to work.

I face this "Jscript runtime error: Object does not support property or method" whenever im trying to run this page.

In my experience, im get this error msg 9 out of 10 times i use javascript in my system.

Im using Microsoft Visual web developer 2008, i wonder if this is related to my problem, i not sure there is anything i need to add as reference or update anything.

But anyway, in short, i just couldn't use javascript code when using this development tool because of this sort of error.

Anyway, it happen that last time i tried use the same type of jquery code in another project and it seems to work well without an error.

But now when im try to use it again in this recent project i created, it come out with this error and i have no idea how to solve it even look through google and this forum.

It doesn't really seems like its the code problem itself although im not sure, because any javascript code just couldn't work.

So below is my code that i need to use.

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" ></script>
<script type="text/javascript" src=&quo

How to authenticate local user usin ldap or non domain authentication



I created one application, and I need to authenticate local user. This user is the user who is login to his/her Personal Computer.. Main thing his that he/she does not in any DOMAIN... I want NON-DOMAIN authentication.. any how.... please help...

help needed: Ldap User authentication using userDN and password



Is it possible to authenticate a user using userDN and password? If so, then tell me the syntax.So far i have tried to authenticate using username and password from my c# code using directoryentry which takes the parameters like domainname,username and password. But i need to authenticate using Userdn and password.

helped needed: ASP LDAP authentication failed in IE 8


I use the following code to do the user authentication through Active Directory using LDAP.

entry = new DirectoryEntry("LDAP://" + server, user_name, password);
if (!string.IsNullOrEmpty(entry.Name))
EmployeeNetId = entry.Username.Substring(0, 3);

// Retrieve EmployeeId, and Employee Full Name
EmployeeId = -1;

It works for Chrome, Firefox with no problem. But with IE 8, it works sometimes, and failed on some computers. When it failed, I figured that I need to check SSL 2.0 in IE 8 Internet Options.  It's weird because in those computers that IE 8 works, SSL 2.0 is also unchecked.

Am I using some deprecated method? Or How do I specifiy the SSL version options in the LDAP connection?

Solved: LDAP authentication: error code 49 - 80090308, comment: AcceptSecurityContext error, data 52

Hi, I have a problem conneting to another domain (far.away.domain). We have a two-way trust to this domain. Also I can access the DS using ADSI edit and our Administrator account (ourdomain.com). I tried several types of credentials (userid = "CN=Administrator,CN=Users,DC=ourdomain,DC=com", "Administrator @ ourdomain.com" (without blanks)...). Connecting to ourdomain.com is no problem, but to far.away.domain I can't connect, I always get the error 525 (user not found). What could be the problem? Have I to use an entry from the ForeignSecurityPrincipals CN of the far.away.domain? I also tried to connect using Softerra LDAPBrowser and a command line ldapsearch without succes and with not a better error message. But why is it not possible to use a trusted account, or is this a active directory feature and does not work with pure LDAP bindings? Best regards, Nils.

Client object model Authentication.

  Sorry for my bad english. With WPF, I can get authentication using below code             ClientContext clientContext = new ClientContext("URL");             clientContext.AuthenticationMode = ClientAuthenticationMode.Default;             NetworkCredential credential = new NetworkCredential("ID", "PASSWORD", "URL");             clientContext.Credentials = credential; But with silverlight, I can't find AuthenticationMode property with ClientContext.   I want to get authentication using client object model with silverlight. Can anybody help me?   thanks!!   

Object does not support this property or method....

This is a pretty straightforward piece of code. Why am I getting this error on line 5 char1?<script type="text/javascript"> function resubmit() { var recip = document.getElementById("web_recip"); var ind=recip.indexof("?resubmit"); if (ind>0){ recip=recip.replace("?resubmit",""); var resub=document.getElementById("resub"); resub.value="Y"; } } </script>  

LDAP - directory entry issue with out user and password using impersonate and windows authentication

Hi All I am using the below code to fetch the user information from LDAP             DirectoryEntry entry = new DirectoryEntry("LDAP://DEV");             DirectorySearcher searcher =  new DirectorySearcher(entry);             SearchResult result;             searcher.Filter = "samaccountname=testuser";             result = searcher.FindOne(); here i am using windows authentication always and along with that when i enable the impersonate = true ,  the code fails at "result = searcher.FindOne();" with message "object reference not set to instance of an object "  also with the same code if i give the username and password along with the impersonate tag >> it works  or if i am using the user and password along with the DirectoryEntry  object then also it will work  but it fails with same user that i gave in impersonate tag / directory entry object with windows authentication enabled  and the  user logged to the application and no username and password tag in directory entry / impersonate tag  Interesting thing is that  in our development server ,  i am able to execute the same code with out user name p

Calling a method with a class object as parameter data type.

   [WebMethod]    public string GetInfo(Customer inCust)    {        // Code in here    } I have a web service that resides on a remote server. I want to call a public method of theweb service named  "GetInfo". The method is shown above. The web service method expects a class object oftype "Customer". What I did to create a Customer object was to define in my asp.net project my own class named "Customer" which is exactlythe same as the class that belongs to the web service project on the remote server. I then created an instance of Customerand tried to call the web service passing in an object of type customer : my.Service ws = new my.Service(); // Get web service connectionCustomer aCustomer = new Customer();aCustomer.Initialize();ws.GetInfo(aCustomer) // call web service passing in a Customer object The problem is that the compiler gives me the following error: Value of type '_Default.Customer' cannot be converted to 'ws.Class1'. Here Default is refering to my Default.aspx.cs code. Why is this? Do I need to Cast my "aCustomer" class object to a type ofws.Customer ? How do I do that?

Changing SQL server Authentication method

Hi We have a SQL server (x64 standard) that is running with sharepoint on it.  Currently we have some custom s/w that need SQL server authentication also but our server is set to "window authentication mode" only.  Could someone please tell me if we can change the authentication method from "windows authentication mode" to "SQL server and Windows authentication mode" while sql is running.  Will they ask us to re-boot or it will take effect immediately?  thanks, Ted.  

OU level authentication - AD/Ldap

I want to write a process where i need to authenticate an user against a particular OU in Active Directory. If the AD holds 50 OUs I don't want the process to look into all 50 OUs , instead it should look into a particular OU( for eg: OU=dotnet users)  to authenticate the user. This is to improve the performance by avoiding the time for looking into the entire directory. How can I achieve this? Appreciate your help!

Provide object over network on callback method

Hello. I am building a client server video monitoring system. I will have a user (viewer) connect to a web page on a server, pick a camera and see what is going on at the particular location. A general WCF question: How can I access VideoSource custom class object remotely on the server via WCF? Basically, I have a VideoSource and VideoSourcePlayer that work great, when are within one process, but how can I access VideoSource object remotely? An example link would be enough. Thank you.  Max Pavlov http://maxpavlov.com

passing messageContract object to a WCF Service method using Soap - not as a method parameter

i want a web application to create a service reference to my WCF service, insert information to the header of the soap call and call my WCF method. my WCF supports soap operations (also there is an endpoint in the config). i read about MessageContract attribute and declared one in the interface file: [ServiceContract] public interface IBasicService { [OperationContract] [WebGet(UriTemplate = "GetData?value={value}")] // Add support for HTTP GET Requests string GetData(int value); } [MessageContract] public class BasicServiceHeader { [MessageHeader] public string myString; } the implementation of the contract : public class BasicService : IBasicService { public string GetData(int value) { return string.Format("You entered: {0}", value); } } i don't want the BasicServiceHeader to be passed as a parameter of GetData function , i want to keep the function signature as it is (without a BasicServiceHeader parameter) and to extract the BasicServiceHeader inside the function, (just like using soapHeader) can i do that ?

An object reference is required for the nonstatic field, method, or property 'object.GetType()'


I'm getting this error, what i'm missing?

error: An object reference is required for the nonstatic field, method, or property 'object.GetType()'


static public void RegisterScriptMethod(System.Web.UI.Page page, string methodName, string methodBody)


StringBuilder sb = new StringBuilder();


"<script language='javascript'>");


"function " + methodName + " {" + methodBody + "}");



//page.RegisterClientScriptBlock(methodName, sb.ToString());

Method 'Post' of object 'IOWSPostData' failed


I have Microsoft Office 2003 and Microsoft Sharepoint Designer 2007 on the
same machine. I have a problem uploading an excel spreadsheet into WSS 3.0.
I get Method 'Post' of object 'IOWSPostData' failed error. I have followed
this article (http://mindsharpblogs.com/Kathy/archive/2008/03/16/4450.aspx)
but it doesn't resolve the issue.
Pls, advise how can I resolve this.

Thank you in advance!


How to user LoadControl(Type type, object[] para) method?



protected void Page_Load(object sender, EventArgs e)
            // This is NOT working. I dont see user control on page
            Type type = Type.GetType("TestProject.UserControls.Gender");                
            Control uc = Page.LoadControl(type,null);            

            //This is working. I can see user control on page
            Control uc1 =  Page.LoadControl("~/UserControls/Gender.ascx");            

 Im trying to load User Control dynamically using LoadControl(Type type, object[] para) method but its not working. I do not get any exception but i dont see user control render on the page. I have a Default parameterless construction in my user control and i see its get executed when i put break point there. but i dont see user control rendered on my page.

If i use OverLoaded method LoadControl(string VirtualPath) then it works fine.


ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend