I Created custom login page .
I use this code for login
if (Membership.ValidateUser(Username.Text, Password.Text))
{
SecurityToken tk = SPSecurityContext.SecurityTokenForFormsAuthentication(
new Uri(SPContext.Current.Web.Url), "ADProvider", null,
Username.Text, Password.Text);
if (tk != null)
{
SPFederationAuthenticationModule fam = SPFederationAuthenticationModule.Current;
fam.SetPrincipalAndWriteSessionToken(tk);
//look for the Source query string parameter and use that as the redirection
string src = page.Request.QueryString["Source"];
if (!string.IsNullOrEmpty(src))
{
Response.Redirect(src, false);
}
else
{
Response.Redirect("/", false);
}
}
I add connectionstring and membersgip for webconfig
<connectionStrings>
<add name="AdConn" connectionString="LDAP://domain.local/DC=domain,DC=local" />
...
<membership defaultProvider="i">
<providers>
...
<add
name="AdProvider"
type="System.Web.Security.ActiveDirectoryMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
connectionStringName="AdConn"
enableSearchMethods="true"
attributeMapUsername="sAMAccountName" />
</providers>
</membership>
...
but when i login , i get
Error: Access Denied

