CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> .NET

 windows Authentication

Print topic Send  topic

Author Message
eltoro

Posts: 4
Posted: 06/11/2008, 2:06 PM

I need help to
Manage user profiles on applications using Active Dir User and windows Authentication on CodeCharge
View profile  Send private message
kieuale

Posts: 8
Posted: 06/30/2008, 2:56 PM

Forget it ....
Doesn't matter how you ask about authentication with Active Directory their replay is always "google". They stated the its not part of CodeCharge feature. I try googling it and yes there is some answer BUT you can NOT use it in CodeCharge, because if you modify anything outside of CodeCharge you cannot bring it back. I am a newbee myself, I also need STEP BY STEP instruction on how to implement Active Directory into CodeCharge. I try as support but they said you need to pay for the consultant/servers. I would like to use AD as the user/password authentication too. BUT how do you modify the Login.aspx form so it will point to the Active Directory server???? :-/ :-< :-(
View profile  Send private message
dgoose

Posts: 1
Posted: 07/01/2008, 2:07 AM

Hi,


Had the same problem.

You have to change the from forms to windows authentication in you web.config file.

Than modify \app_code\components\MembershipProvider.cs

There is a method called ValidateUser(string username, string password)
Within that method you can check if the user is authenticated.

if(!HttpContext.Current.User.Identity.IsAuthenticated) return false;

Thats all.

If you like to get attributes from AD you have to build a method with the directory services class.

All the best.
Dieter
View profile  Send private message
cvboucher

Posts: 191
Posted: 07/01/2008, 8:34 AM

Just in case someone found it useful I'll post my code for doing AD/LDAP Authentication. In our app we maintain a table of users who are allowed login the app (I know we could do this with groups but we didn't want to go that route). This table only contains the AD login (no passwords). If the AD authentication is successful then the regular authentication code executes but we set both the user id and password to the login control (in both the security settings and the Login action). We place the following custom code immediately before the Login action on the Button_DoLogin control.

Dim entry As New System.DirectoryServices.DirectoryEntry("LDAP://csustan.edu/dc=csustan,dc=edu", Loginlogin.Text, Loginpassword.Text, System.DirectoryServices.AuthenticationTypes.Secure)  
Try  
	entry.RefreshCache()  
Catch ex As Exception  
	LoginErrors.Add("",Resources.strings.CCS_LoginError)  
	ErrorFlag = True  
End Try  

We use the following code immediately after the previous code to get additional AD attributes.

If ErrorFlag=False  
	Dim ds As New DirectorySearcher(entry, "sAMAccountName=" & Loginlogin.Text, New String() {"csustanEduPersonPeopleSoftID"}, System.DirectoryServices.SearchScope.Subtree)  
	Dim sr As SearchResult = ds.FindOne()  
	If sr.Properties.Contains("csustanEduPersonPeopleSoftID") Then  
		HttpContext.Current.Session("EMPLID") = sr.Properties("csustanEduPersonPeopleSoftID")(0)  
	End If  
End If  

If you don't want to maintain a table of users then set the UserID, UserLogin and GroupID session variables to values from your AD (like I did above with EMPLID).

Craig
View profile  Send private message
kieuale

Posts: 8
Posted: 07/01/2008, 4:04 PM

Hi Craig,
Your posting is pretty useful. At lease, its getting me closer on the procedure wise and more understanding on how to authenticate with AD using the Login.aspx form. Thank You. :-O

Here is my ERROR while testing your code:
Type "System.DirectoryServices.DirectoryEntry" not defined.

I had try placing the Imports System.DirectoryServices line on the top but it still dose not work.
Is there any other step I am missing? Please Help, Thank You. :-(
View profile  Send private message
Vlad

Posts: 3
Posted: 07/03/2008, 3:53 AM

Quote kieuale:
Hi Craig,
Your posting is pretty useful. At lease, its getting me closer on the procedure wise and more understanding on how to authenticate with AD using the Login.aspx form. Thank You. :-O

Here is my ERROR while testing your code:
Type "System.DirectoryServices.DirectoryEntry" not defined.

I had try placing the Imports System.DirectoryServices line on the top but it still dose not work.
Is there any other step I am missing? Please Help, Thank You. :-(

kieuale, You need to add a reference to the System.DirectoryServices assembly.
Add System.DirectoryServices to the Assemblies property of your project and copy the system.directoryservices.dll file from .NET folder to your Bin folder.
View profile  Send private message
cvboucher

Posts: 191
Posted: 07/03/2008, 9:46 AM

I had to add the following line to Assemblies under Server/Script in the Project Settings:

System.DirectoryServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A

I didn't have to copy the .dll to the Bin folder but I'm running .Net 2.0 which may be different then 1.1

Craig
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright 2003-2004 by UltraApps.com  and YesSoftware, Inc.