Already logged in when trying to use AD authentication ASP.Net and logoff never works

JasonBrood

New Member
I am using AD authentication using forms. The problem I am facing is that since I have already logged into the network on the computer, the webpage shows that I am already logged in. And stay logged in even if I click the logoff button.This happens only when I deploy the website in IIS 7. When I test the code in debug mode the login/logoff button seems to work fine.Is there something that needs to change in IIS 7 setting or just the code is incorrect?Any help is appreciated.Here is the web.config section of the AD\[code\]<connectionStrings> <add name="ADService" connectionString="LDAP://Dcxxx.xxxx.local"/></connectionStrings><membership defaultProvider="AspNetActiveDirectoryMembershipProvider"> <providers> <add name="AspNetActiveDirectoryMembershipProvider" type="System.Web.Security.ActiveDirectoryMembershipProvider, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" attributeMapUsername="sAMAccountName" connectionStringName="ADService" enableSearchMethods="true"/> </providers>\[/code\]Then the forms authentication par is\[code\]<authentication mode="Forms"> <forms loginUrl="~/Account/Login.aspx" name=".ADAuthCookie" timeout="15" slidingExpiration="false" protection="All"/> </authentication> <authorization> <deny users="?" /> <allow users="*" /> </authorization>\[/code\]In the sitemaster.aspx.csI have added the following code to force logging off\[code\]protected void Unnamed2_LoggingOut(object sender, LoginCancelEventArgs e) { HttpContext.Current.Session.Clear(); HttpContext.Current.Session.Abandon(); ViewState.Clear(); FormsAuthentication.SignOut(); Response.Redirect("~/Account/Login.aspx"); }\[/code\]
 
Back
Top