Results 1 to 6 of 6

Thread: getting red underline under "if (IsAuthenticated)" Error on Line 19 in asp.net program.

  1. #1
    Join Date
    Jan 2012
    Posts
    49

    getting red underline under "if (IsAuthenticated)" Error on Line 19 in asp.net program.

    I am currently studying asp.net programs and I have mastered the concepts well. But however , I am not able to solve this issue . can you sort out for me. I am with an error on line 19 and I am getting red underline under "if (IsAuthenticated)". I will provide with the entire code along this one. So can you guys solve it for me.

    Code:
    using System;
    using System.Net; 
    using System.DirectoryServices; 
    using System.Collections.Generic;
    using System.Web; 
    using System.Linq;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    
    namespace SSS23 
    {
        public partial class _Default : System.Web.UI.Page
        {
            protected void btnLogin_Click(object user , EventArgs e)
            {
                string DomainName = "ldap://14.67.804.45:624";
                IsAuthenticated(DomainName, TextBox3.Text, TextBox5.Text);
               
    
    if (IsAuthenticated)
                {
                    lblResult.Text = "login Success";
                }
                else
                {
                    lblResult.Text = "login failed";
                }
            }
            public bool IsAuthenticated(String domain, String username, String pwd)
            {
                
                string _path = "LDAP:// 14.67.804.45:624";
                string _filterAttribute = "";
                String domainAndUsername = domain + @"\" + username;
                DirectoryEntry entry = new DirectoryEntry(_path, domainAndUsername, pwd);
                bool returnval = true;
                string ErrDesc = "";
    
                try
                {
                                    Object obj = entry.NativeObject;
                    DirectorySearcher search = new DirectorySearcher(entry);
                    search.Filter = "(sssAccountName=" + username + ")";
                    search.PropertiesToLoad.Add("cn");
                    SearchResult result = search.FindOne();
                    if (null == result)
                    {
                        returnval = false;
                    }
    
                    _path = result.Path;
                    _filterAttribute = (String)result.Properties["cn"][0];
                }
                catch (Exception ex)
                {
                    returnval = false;
                    ErrDesc = "Error authenticating user. " + ex.Message;
                }
    
                return returnval;
            }
    
        }
    }

  2. #2
    Join Date
    Dec 2010
    Posts
    107

    Re: getting red underline under "if (IsAuthenticated)" Error on Line 19 in asp.net program.

    As you are more concerned with the authentication part, I need to say that you need to provide with me that what is isauthenticated supposed to be? I am not able to see a property or else variable with the similar name. I am able to see an isauthenticated method. So can you specify further in this case.

  3. #3
    Join Date
    Mar 2011
    Posts
    166

    Re: getting red underline under "if (IsAuthenticated)" Error on Line 19 in asp.net program.

    I have found this error and you can try with this one. You need to change the line by bool IsAuthenticated = IsAuthenticated(DomainName, TextBox3.Text, TextBox5.Text); and it will eb solved. It will take a bool value and you need to specify the domain name .

  4. #4
    Join Date
    May 2011
    Posts
    111

    Re: getting red underline under "if (IsAuthenticated)" Error on Line 19 in asp.net program.

    I made some changes and it was solved in my case. I made some changes in the

    public bool IsAuthenticated(String domain, String username, String pwd)

    TO

    public bool IsAuthenticated(DomainName, TextBox3.Text, TextBox5.Text)
    and it was solved. You can attempt this one and then reply for the same.

  5. #5
    Join Date
    May 2011
    Posts
    99

    Re: getting red underline under "if (IsAuthenticated)" Error on Line 19 in asp.net program.

    I need to say that we are definite that there are some errors or you will be having some variable name issues and I have attempted in this case and after making the below change you will have a correct result.
    Code:
    bool result = IsAuthenticated(DomainName, TextBox3.Text, TextBox5.Text);
                if (result)
                {
                    lblResult.Text = "login Success";
                }
                else
                {
                    lblResult.Text = "login failed";
                }

  6. #6
    Join Date
    Jan 2012
    Posts
    49

    Re: getting red underline under "if (IsAuthenticated)" Error on Line 19 in asp.net program.

    Thanks for the replies and it was solved I made some changes and after this one everything was sorted out. "DirectorySearcher search = new DirectorySearcher(entry);" and after putting an breakpoint , it was solved in my case.

Similar Threads

  1. Replies: 6
    Last Post: 06-07-2012, 12:14 PM
  2. Windows Showing Webpage error: "Out of memory on line:17"
    By Aaryan2011 in forum Operating Systems
    Replies: 1
    Last Post: 23-08-2011, 11:17 PM
  3. Internet explorer 7:script error "line 1507 char 1" while print a page
    By Nammed Khuri in forum Technology & Internet
    Replies: 3
    Last Post: 11-02-2011, 12:17 PM
  4. MS Word 2007 "underline" tag
    By Don_Lightfoot in forum Windows Software
    Replies: 5
    Last Post: 22-07-2009, 07:10 PM
  5. Replies: 2
    Last Post: 08-09-2008, 02:15 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •