Note that there are some explanatory texts on larger screens.

plurals
  1. POCom Interop error when using impersonation on ASP.NET
    primarykey
    data
    text
    <p>I am trying to write a ASP.NET page that looks at group membership for authorization of a site. I have code that is working when run in the local debugger and when locally logged into the web server itself. However, when i try to access the page from a remote web browser, i get an error.</p> <pre><code>System.Runtime.InteropServices.COMException: An operations error occurred. </code></pre> <p>I have impersonation turned on and I have it set to only Windows Authentication turned on. Is there something I am missing?</p> <p>Here's the stack trace:</p> <pre><code>[COMException (0x80072020): An operations error occurred.] System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail) +387793 System.DirectoryServices.DirectoryEntry.Bind() +36 System.DirectoryServices.DirectoryEntry.get_AdsObject() +31 System.DirectoryServices.PropertyValueCollection.PopulateList() +21 System.DirectoryServices.PropertyValueCollection..ctor(DirectoryEntry entry, String propertyName) +49 System.DirectoryServices.PropertyCollection.get_Item(String propertyName) +135 System.DirectoryServices.AccountManagement.PrincipalContext.DoLDAPDirectoryInitNoContainer() +1124 System.DirectoryServices.AccountManagement.PrincipalContext.DoDomainInit() +37 System.DirectoryServices.AccountManagement.PrincipalContext.Initialize() +118 System.DirectoryServices.AccountManagement.PrincipalContext.get_QueryCtx() +31 System.DirectoryServices.AccountManagement.Principal.FindByIdentityWithTypeHelper(PrincipalContext context, Type principalType, Nullable`1 identityType, String identityValue, DateTime refDate) +14 System.DirectoryServices.AccountManagement.Principal.FindByIdentityWithType(PrincipalContext context, Type principalType, String identityValue) +73 System.DirectoryServices.AccountManagement.UserPrincipal.FindByIdentity(PrincipalContext context, String identityValue) +25 WebConfigValue.GroupForms.GroupSearchForm1.GetGroupNames(String userName) in C:\dev\code\Projects\Web\WebConfigValue\WebConfigValue\default.aspx.cs:224 WebConfigValue.GroupForms.GroupSearchForm1.Page_Load(Object sender, EventArgs e) in C:\dev\code\Projects\Web\WebConfigValue\WebConfigValue\default.aspx.cs:45 System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +51 System.Web.UI.Control.OnLoad(EventArgs e) +92 System.Web.UI.Control.LoadRecursive() +54 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +772 </code></pre> <p>It appears to be happening in the FindByIdentity portion of the GetGroupNames code i wrote.</p> <pre><code> public List&lt;string&gt; GetGroupNames(string userName) { var result = new List&lt;string&gt;(); using (PrincipalContext pc = new PrincipalContext(ContextType.Domain, "NPC")) { using (PrincipalSearchResult&lt;Principal&gt; src = UserPrincipal.FindByIdentity(pc, userName).GetGroups(pc)) { src.ToList().ForEach(sr =&gt; result.Add(sr.SamAccountName)); } } return result; } </code></pre> <p>Like i said, it works fine when run locally on my dev box or on the web server. It's only when accessing from a remote brower that i get the error.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload