|
| ||||||||||
| Tags: aspnet, isauthenticated, programming language, web application |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| |||
| |||
| getting red underline under "if (IsAuthenticated)" Error on Line 19 in asp.net program.
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
| |||
| |||
| 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
| |||
| |||
| 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
| |||
| |||
| 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
| |||
| |||
| 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
| |||
| |||
| 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. |
![]() |
|
| Thread Tools | Search this Thread |
| |
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 |