Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



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

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 21-03-2012
Member
 
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;
        }

    }
}

Reply With Quote
  #2  
Old 21-03-2012
Member
 
Join Date: Dec 2010
Posts: 105
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.
Reply With Quote
  #3  
Old 21-03-2012
Member
 
Join Date: Mar 2011
Posts: 155
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 .
Reply With Quote
  #4  
Old 21-03-2012
Member
 
Join Date: May 2011
Posts: 103
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.
Reply With Quote
  #5  
Old 21-03-2012
Member
 
Join Date: May 2011
Posts: 95
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";
            }
Reply With Quote
  #6  
Old 22-03-2012
Member
 
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.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "getting red underline under "if (IsAuthenticated)" Error on Line 19 in asp.net program."
Thread Thread Starter Forum Replies Last Post
Starting Spec Ops: The Line gives error "sync out of range" on monitor Nasir h Video Games 6 06-07-2012 12:14 PM
Windows Showing Webpage error: "Out of memory on line:17" Aaryan2011 Operating Systems 1 23-08-2011 11:17 PM
Internet explorer 7:script error "line 1507 char 1" while print a page Nammed Khuri Technology & Internet 3 11-02-2011 12:17 PM
MS Word 2007 "underline" tag Don_Lightfoot Windows Software 5 22-07-2009 07:10 PM
Sony to Start License Program "Designed for Walkman" to Expand Walkman Exclusive Accessory Line-up Humberto Portable Devices 2 08-09-2008 02:15 PM


All times are GMT +5.5. The time now is 10:22 AM.