I tried some of the methods described above with no success. I followed the steps in http://forums.asp.net/p/897609/971665.aspx#971665, and now it forces a login on EVERY intranet website, not just my project site. I'm in the process of figuring out what I did to cause that one, hoping it's just our filter and not me...
Here's the error it gives when trying to hit AD to pull the LDAP query. It fails on line 131 below:
Server Error in '/ptm' Application.
--------------------------------------------------------------------------------
The specified domain either does not exist or could not be contacted.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Runtime.InteropServices.COMException: The specified domain either does not exist or could not be contacted.
Source Error:
Line 129: mySearcher.Filter = ("anr=" + userid);
Line 130: mySearcher.PropertiesToLoad.Add("Title");
Line 131: SearchResult result = mySearcher.FindOne();
Line 132: DirectoryEntry de = result.GetDirectoryEntry();
Line 133: membership = (string)de.Properties["Title"].Value;
Stack Trace:
[COMException (0x8007054b): The specified domain either does not exist or could not be contacted.
]
System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail) +610
System.DirectoryServices.DirectoryEntry.Bind() +36
System.DirectoryServices.DirectoryEntry.get_AdsObject() +31
System.DirectoryServices.DirectorySearcher.FindAll(Boolean findMoreThanOne) +73
System.DirectoryServices.DirectorySearcher.FindOne() +42
_Default.GetUserMember(String userid) in c:\IT Development\ptm\table_management.aspx.cs:131
_Default.Page_Load(Object sender, EventArgs e) in c:\IT Development\ptm\table_management.aspx.cs:50
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +15
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +34
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +47
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1061
This has to be something simple I'm doing wrong, it can't be this difficult for an already authenticated user to be granted access to a specific page in a website based on values associated with their AD account.