Link to home
Start Free TrialLog in
Avatar of Sha1395
Sha1395

asked on

Error :"The name (fname) doesn't exist in the current context"

I have code like below,but am trying to pas fname to search filter its throwing error

Error :"The name (fname) doesn't exist in the current context",some one enlighten me

if (username.Contains("."))
            {
                string Fname = username.Substring(0, username.IndexOf("."));
                Fname = Fname.Replace(" ", "");

                string[] splitString = username.Split(new char[] { '.' });
                username = splitString[splitString.Length - 1];

}


if (username.IndexOf(" ") > 0)

                    search.Filter = "(cn=" + username + ")";

                else

                      search.Filter = "(sn=" + username + ")(givenname=" + Fname + ")";

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Carl Tawn
Carl Tawn
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Sha1395
Sha1395

ASKER

Thanks a lot Sudhakar for your wonderful explanation but some how i figured it out and completed the code.

anyway thank  you so much.
I've requested that this question be deleted for the following reason:

This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
Author has figured out the same aolution which is suggested by carl_tawn and my self provided an explanation for the question asked for.

Hence solution assistence is provided by both the comments which is also accepted by the author.
All,
 
Following an 'Objection' by Sudhakar-Pulivarthi (at https://www.experts-exchange.com/questions/27177969/Automated-Request-for-Review-Objection-to-Delete-Q-26843333.html) to the intended closure of this question, it has been reviewed by at least one Moderator and is being closed as recommended by the Expert.
 
At this point I am going to re-start the auto-close procedure.
 
Thank you,
 
SouthMod
Community Support Moderator