1>E:\MIS PORTAL FINAL\MIS PORTAL\WebApplication1\Models\AdAuthenticationService.cs(49,70,49,88): error CS0103: The name 'authenticationType' does not exist in the current context
when i am running the application its work Fine When Publish the Website getting error
public AuthenticationResult SignIn(String username, String password)
{
#if DEBUG
// authenticates against your local machine - for development time
// ContextType authenticationType = ContextType.Machine;
// authenticates against your Domain AD
ContextType authenticationType = ContextType.Domain;
#endif
PrincipalContext principalContext = new PrincipalContext(authenticationType);
bool isAuthenticated = false;
UserPrincipal userPrincipal = null;
try
{
isAuthenticated = principalContext.ValidateCredentials(username, password, ContextOptions.Negotiate);
if (isAuthenticated)
{
userPrincipal = UserPrincipal.FindByIdentity(principalContext, username);
}
}
catch (Exception)
{
isAuthenticated = false;
userPrincipal = null;
}
if (!isAuthenticated || userPrincipal == null)
{
return new AuthenticationResult("Username or Password is not correct");
}
if (userPrincipal.IsAccountLockedOut())
{
// here can be a security related discussion weather it is worth
// revealing this information
return new AuthenticationResult("Your account is locked.");
}
if (userPrincipal.Enabled.HasValue && userPrincipal.Enabled.Value == false)
{
// here can be a security related discussion weather it is worth
// revealing this information
return new AuthenticationResult("Your account is disabled");
}
var identity = CreateIdentity(userPrincipal);
authenticationManager.SignOut(MyAuthentication.ApplicationCookie);
authenticationManager.SignIn(new AuthenticationProperties() { IsPersistent = false }, identity);
return new AuthenticationResult();
}
at this line getting error when publish the Website
PrincipalContext principalContext = new PrincipalContext(authenticationType);