I have searched google over and over and none of the solutions match my scenario.
My project uses Windows Authentication and I have a class file that does the LDAP work for me. However whenever it hits this line in the class file IsAuthenticated is always false.
I have two projects that use the same exact class file and have very similar webconfig files. The IsAuthenticated returns true in my other project. The only difference between the projects really is that the new one that isn't working was created in VS 2012
and the other was created in VS 2010.
I am running these applications from VS 2012 in debug mode. If you know of anything I could be missing or could check please let me know. If I need to insert any code to assist in an anwer I will do so thusly.
I stated above that I am using Windows Authentication, it is configured inside the WebConfig.
I am checking for IsAuthenticated inside my ldap class file, the class file is called inside my default.aspx.cs. It utilizes a method I created to get the first and last name from Active Directory. Like I was saying the same setup works fine in my other project
and they're configured from what I can tell exactly the same.
I stated above that I am using Windows Authentication, it is configured inside the WebConfig.
I am checking for IsAuthenticated inside my ldap class file, the class file is called inside my default.aspx.cs. It utilizes a method I created to get the first and last name from Active Directory. Like I was saying the same setup works fine in my other project
and they're configured from what I can tell exactly the same.
Any insight is helpful.
Ok, so the two statements "I'm using windows auth" and "I'm using LDAP" were confusing. You're usign windows auth for authentication and from that you're using LDAP to obtain more identity information for the authenticated user. Now I got ya.
So the only thing I'm guessing is that the server is not challenging the browser for authentication. In other words the user is not hitting a 401/Unauthorized anywhere and so then the browser isn't authenticating.
There really isn't a server. I am running the project on local host from Visual Studio 2012 so the server is setup itself. I can literally have both projects up, run one and the IsAuthenticated is true with all user information, the other project is always
false. It is the weird thing I have seen. I know it's probably something silly that I am overlooking but every single thing looks identical to my other project.
Started looking into this again this morning. It appears as though the project doesn't recognized my authentication type, even though I have the correct configuration in the web config file.
If I look in System.Security.Principal.WdinwosIdentity
AuthenticationType ""
IsAuthenticated false
Name ""
I am just not sure why it wouldn't use the authentication mode I have set in the web config file...
For some reason the "Servers" property was set to use Local IIS Web Server instead of Uesr Visual Studio Development Server. That is why I was seeing a difference between the applications.
To fix this issue if you're seeing something similiar.
Right click your Solution, click properties. Go to Web on the left hand side. Under Servers select "Use Visual Studio Development Server".
If you're having this problem and you don't use the development server, there is probably something misconfigured with your local IIS server. Thanks for the help.
Marked as answer by Abrham on Jan 28, 2013 12:04 PM
Abrham
Member
2 Points
6 Posts
IsAuthenticated = false
Jan 25, 2013 12:16 PM|LINK
I have searched google over and over and none of the solutions match my scenario.
My project uses Windows Authentication and I have a class file that does the LDAP work for me. However whenever it hits this line in the class file IsAuthenticated is always false.
I have two projects that use the same exact class file and have very similar webconfig files. The IsAuthenticated returns true in my other project. The only difference between the projects really is that the new one that isn't working was created in VS 2012 and the other was created in VS 2010.
I am running these applications from VS 2012 in debug mode. If you know of anything I could be missing or could check please let me know. If I need to insert any code to assist in an anwer I will do so thusly.
BrockAllen
All-Star
27434 Points
4891 Posts
MVP
Re: IsAuthenticated = false
Jan 26, 2013 12:15 AM|LINK
You need to provide more details. How is the app configured for authentication and when/where are you checking for IsAuthenticated?
DevelopMentor | http://www.develop.com
thinktecture | http://www.thinktecture.com/
Abrham
Member
2 Points
6 Posts
Re: IsAuthenticated = false
Jan 26, 2013 12:56 AM|LINK
I stated above that I am using Windows Authentication, it is configured inside the WebConfig.
I am checking for IsAuthenticated inside my ldap class file, the class file is called inside my default.aspx.cs. It utilizes a method I created to get the first and last name from Active Directory. Like I was saying the same setup works fine in my other project and they're configured from what I can tell exactly the same.
Any insight is helpful.
BrockAllen
All-Star
27434 Points
4891 Posts
MVP
Re: IsAuthenticated = false
Jan 26, 2013 01:03 AM|LINK
Ok, so the two statements "I'm using windows auth" and "I'm using LDAP" were confusing. You're usign windows auth for authentication and from that you're using LDAP to obtain more identity information for the authenticated user. Now I got ya.
So the only thing I'm guessing is that the server is not challenging the browser for authentication. In other words the user is not hitting a 401/Unauthorized anywhere and so then the browser isn't authenticating.
DevelopMentor | http://www.develop.com
thinktecture | http://www.thinktecture.com/
Abrham
Member
2 Points
6 Posts
Re: IsAuthenticated = false
Jan 26, 2013 04:57 AM|LINK
There really isn't a server. I am running the project on local host from Visual Studio 2012 so the server is setup itself. I can literally have both projects up, run one and the IsAuthenticated is true with all user information, the other project is always false. It is the weird thing I have seen. I know it's probably something silly that I am overlooking but every single thing looks identical to my other project.
Abrham
Member
2 Points
6 Posts
Re: IsAuthenticated = false
Jan 28, 2013 11:33 AM|LINK
Started looking into this again this morning. It appears as though the project doesn't recognized my authentication type, even though I have the correct configuration in the web config file.
If I look in System.Security.Principal.WdinwosIdentity
AuthenticationType ""
IsAuthenticated false
Name ""
I am just not sure why it wouldn't use the authentication mode I have set in the web config file...
Abrham
Member
2 Points
6 Posts
Re: IsAuthenticated = false
Jan 28, 2013 12:04 PM|LINK
Found the Solution!!
For some reason the "Servers" property was set to use Local IIS Web Server instead of Uesr Visual Studio Development Server. That is why I was seeing a difference between the applications.
To fix this issue if you're seeing something similiar.
Right click your Solution, click properties. Go to Web on the left hand side. Under Servers select "Use Visual Studio Development Server".
If you're having this problem and you don't use the development server, there is probably something misconfigured with your local IIS server. Thanks for the help.