login with active directory autentication in asp.net c# -


i creating asp.net web application. in used active directory login. have 1 group named validusers, when user logged in checks user validusers group. if user exists in group login successful, if not login failed.

i did things, works in local machine, not working when publishing website. got following error

 logon failure: unknown user name or bad password.  

on machine works good,while publishing got error.i used below code reference

principalcontext ctx = new principalcontext(contexttype.domain, "domainname"); system.security.principal.windowsidentity myidentity = system.security.principal.windowsidentity.getcurrent(); string loguser = myidentity.name.tostring(); userprincipal user = userprincipal.findbyidentity(ctx, loguser); groupprincipal group = groupprincipal.findbyidentity(ctx, "validusers");validusers---->groupname  if (user.ismemberof(group))  {     login success  } else { login failed } 

it check logged user validusers group.if user exists in group login success other wise failed login. got error when published website.please give solution

although had supplied little information domain , network relationship development machine , web server, assume web server has no physical connection active directory server depend code on. should impossible web server query ad directory. if web , ad servers on same network may need work on firewall settings of both web server , ad server make sure can communicate. if web , ad server have no communication problems should check availability of "validusers" code running @ web server. iis applications run user account defined application pool hosts application, should make sure app pool identity has enough rights access delicate information.


Comments

Popular posts from this blog

matlab - Deleting rows with specific rules -

image - ClassNotFoundException when add a prebuilt apk into system.img in android -