locked
AD Authentication Silverlight app within a Page Viewer in SharePoint RRS feed

  • Question

  • Hi everyone,

    I am using the following code to check if a pc is in an active directory group:

    string pcname = System.Environment.MachineName.ToString();
    PrincipalContext ctx = new PrincipalContext(ContextType.Domain);

    public static bool IsPcMemberofLocationGroup(PrincipalContext ctx, string pcName, string groupName)

    {

            public static bool IsPcMemberofLocationGroup(PrincipalContext ctx, string pcName, string groupName)
            {
                bool found = false;
                GroupPrincipal group = GroupPrincipal.FindByIdentity(ctx, groupName);
                if (group != null)
                {                              
                    PrincipalSearchResult<Principal> Groupmembers = group.GetMembers();
                    foreach(Principal member in Groupmembers)
                    {
                        found = string.Compare(member.Name, pcName, true) == 0;
                    }                                   
                }
                return found;
    }

    Everything works fine but when I upload the app to Sharepoint  within a Page Viewer it just not authenticate my pc right. My silverlihgt app is located in a different port from the main sharepoint but within the same server. Does anybody has an idea what is happening?

    Monday, April 30, 2012 1:30 PM

Answers