Click here to Skip to main content
15,919,423 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: crystal reports vesion 2005 Pin
Venkatesh Mookkan5-Jul-07 20:32
Venkatesh Mookkan5-Jul-07 20:32 
GeneralRe: crystal reports vesion 2005 Pin
Sonia Gupta5-Jul-07 20:39
Sonia Gupta5-Jul-07 20:39 
GeneralRe: crystal reports vesion 2005 Pin
Venkatesh Mookkan5-Jul-07 20:43
Venkatesh Mookkan5-Jul-07 20:43 
GeneralRe: crystal reports vesion 2005 Pin
Sonia Gupta5-Jul-07 20:47
Sonia Gupta5-Jul-07 20:47 
Questionsplit function in java script Pin
deepalititi5-Jul-07 19:57
deepalititi5-Jul-07 19:57 
AnswerRe: split function in java script Pin
Venkatesh Mookkan5-Jul-07 20:03
Venkatesh Mookkan5-Jul-07 20:03 
GeneralRe: split function in java script Pin
deepalititi5-Jul-07 20:41
deepalititi5-Jul-07 20:41 
QuestionIssues with ADSI Pin
Sankara Narayana5-Jul-07 19:48
Sankara Narayana5-Jul-07 19:48 
Hi i am new to ADSI programming , so please bear me if i make wrong statements

Created a method to get the user names as in a console application as...

private static string GetUserName( string loginName ) 
{
     string strName;
     string dcName = "";
     string dName = "DomainName";

     char[] sep = {'.'};
     string[] str = dName.Split(sep);
     int i, len = str.Length;

     string appPath = "LDAP://";

     for ( i = 0; i < len; i++ )
     {
        dcName = "dc = "+str[i]+" ";
        appPath = appPath + dcName + ","; 
     }

     appPath = appPath.Remove( appPath.Length-1,1 ); 

     DirectoryEntry entry = new DirectoryEntry(appPath);

     DirectorySearcher mySearcher = new DirectorySearcher(entry);

     try
     {
         mySearcher.Sort.PropertyName = "CN";

         mySearcher.Filter = 
            ( "&(objectClass=user)(SAMAccountName="+ loginName +")" );

//( "&(ObjectCategory=user)(SAMAccountName="+ loginName +")" ); 
// ==> for this too same kind of exception was thrown

         mySearcher.PageSize = 25;
         i = 0;

         SearchResult result = mySearcher.FindOne();

         strName = result.GetDirectoryEntry().Name;
         //string ak = result.GetDirectoryEntry().Username.ToString(); 

         strName = strName.Remove(0, 3);

         return strName;
      }
      catch(Exception exe)
      {
         throw(exe);
      }
      finally
      {
        if (entry != null)
        { 
          entry.Dispose(); 
        }

        if (mySearcher != null)
        {
          mySearcher.Dispose();
        }

        Console.ReadLine();
       }
    }


But when invoked as GetUserName(loginName);
It showed an exception through dialog box as...

An unhandled exception of type 'System.ArgumentException' occurred in ActiveDirectoryQuerying.exe

Additional information: The &(objectClass=user)(SAMAccountName=user1) search filter is invalid.

Please Help...

O
AnswerRe: Issues with ADSI Pin
Sathesh Sakthivel5-Jul-07 19:56
Sathesh Sakthivel5-Jul-07 19:56 
QuestionHow to play songs Pin
Kurian_Kurian5-Jul-07 19:46
Kurian_Kurian5-Jul-07 19:46 
QuestionIssues with ADSI Pin
Sankara Narayana5-Jul-07 19:43
Sankara Narayana5-Jul-07 19:43 
Questionwhat is the using directive for "dataset" in asp.net Pin
$h@ma!|@5-Jul-07 19:40
$h@ma!|@5-Jul-07 19:40 
AnswerRe: what is the using directive for "dataset" in asp.net Pin
Sonia Gupta5-Jul-07 19:44
Sonia Gupta5-Jul-07 19:44 
GeneralRe: what is the using directive for "dataset" in asp.net Pin
$h@ma!|@5-Jul-07 19:51
$h@ma!|@5-Jul-07 19:51 
GeneralRe: what is the using directive for "dataset" in asp.net Pin
Sonia Gupta5-Jul-07 20:02
Sonia Gupta5-Jul-07 20:02 
GeneralRe: what is the using directive for "dataset" in asp.net Pin
$h@ma!|@5-Jul-07 20:10
$h@ma!|@5-Jul-07 20:10 
GeneralRe: what is the using directive for "dataset" in asp.net Pin
DKalepu5-Jul-07 20:15
DKalepu5-Jul-07 20:15 
GeneralRe: what is the using directive for "dataset" in asp.net Pin
Sonia Gupta5-Jul-07 20:16
Sonia Gupta5-Jul-07 20:16 
GeneralRe: what is the using directive for "dataset" in asp.net Pin
$h@ma!|@5-Jul-07 20:49
$h@ma!|@5-Jul-07 20:49 
GeneralRe: what is the using directive for "dataset" in asp.net Pin
Sonia Gupta5-Jul-07 21:07
Sonia Gupta5-Jul-07 21:07 
QuestionTextbox Boundries Pin
minibansal5-Jul-07 19:25
minibansal5-Jul-07 19:25 
QuestionPaging in Gridview Pin
BINOVAR5-Jul-07 19:09
BINOVAR5-Jul-07 19:09 
AnswerRe: Paging in Gridview Pin
Sonia Gupta5-Jul-07 19:15
Sonia Gupta5-Jul-07 19:15 
AnswerRe: Paging in Gridview Pin
Elizma5-Jul-07 19:16
Elizma5-Jul-07 19:16 
AnswerRe: Paging in Gridview Pin
Sathesh Sakthivel5-Jul-07 19:16
Sathesh Sakthivel5-Jul-07 19:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.