I have built a site that used forms authentication.
Logging in works initially but after like 20 or 30 secs, I get logged out. I suspect it is because the cookie is getting lost somehow.
Any reasons why this may happen?
<?xml version="1.0"?> <!-- Note: As an alternative to hand editing this file you can use the web admin tool to configure settings for your application. Use the Website->Asp.Net Configuration option in Visual Studio. A full list of settings and comments can be found in machine.config.comments usually located in \Windows\Microsoft.Net\Framework\v2.x\Config --> <configuration> <configSections> <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/> <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere"/> <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/> <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/> <section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/> </sectionGroup> </sectionGroup> </sectionGroup> <sectionGroup name="n2" type="N2.Configuration.SectionGroup, N2"> <section name="host" type="N2.Configuration.HostSection, N2" requirePermission="false"/> <section name="engine" type="N2.Configuration.EngineSection, N2" requirePermission="false"/> <section name="database" type="N2.Configuration.DatabaseSection, N2" requirePermission="false"/> <section name="edit" type="N2.Configuration.EditSection, N2" requirePermission="false"/> <section name="templates" type="N2.Templates.Configuration.TemplatesSection, N2.Templates" requirePermission="false"/> </sectionGroup> </configSections> <appSettings> <add key="Telligent.Glow.MultipleFileUpload.FileManagerProvider" value="CommunityServer.Components.MultipleUploadFileManager, CommunityServer.Components"/> <add key="Telligent.Glow.MultipleFileUpload.UploadHandlerUrl" value="~/multipleupload.ashx"/> </appSettings> <connectionStrings configSource="connectionStrings.config"/> <n2 xmlns="http://n2cms.com/schemas/configuration/v3"> <!-- If you install a database from scrach you'll need to insert some required pages. This can be done by the web based installer located at http://yoursite/install/edit --> <host rootID="716" startPageID="717" multipleSites="false"> <!-- Make sure to enable wildcard mapping to use empty extension --> <web extension=".aspx"/> <outputCache enabled="false" duration="10"/> </host> <engine> <assemblies> <!-- These assembly declarations are not necessary unless you run in medium trust --> <add assembly="N2"/> <add assembly="N2.Security"/> <add assembly="N2.Edit"/> <add assembly="N2.Templates"/> </assemblies> <!-- Update email to receive error reports --> <errors action="Email" mailTo="" mailFrom="noreply@yourdomain.com"/> <!-- Globalization requires you to create additional start pages with a language --> <globalization enabled="true"/> <!-- Will ping the site to prevent it from sleeping --> <scheduler keepAlive="false" interval="10"/> </engine> <!-- Other flavours: SqlServer2005, SqlServer2000, MySql, SqLite, SqlCe, Firebird --> <database connectionStringName="SiteSqlServer" flavour="SqlServer2005" caching="true" cacheProviderClass="NHibernate.Caches.SysCache2.SysCacheProvider, NHibernate.Caches.SysCache2"/> <edit> <!-- Set checkInstallationStatus to false to disable redirect to install page --> <installer checkInstallationStatus="true"/> <uploadFolders/> </edit> <templates masterPageFile="~/Themes/ChubNelson/Common/template.master"/> </n2> <system.web> <!-- Set compilation debug="true" to insert debugging symbols into the compiled page. Because this affects performance, set this value to true only during development. --> <webServices> <protocols> <add name="HttpGet"/> <add name="HttpPost"/> </protocols> </webServices> <compilation debug="true"> <assemblies> <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> </assemblies> <expressionBuilders> <add expressionPrefix="CurrentItem" type="N2.Web.Compilation.CurrentItemExpressionBuilder, N2"/> <add expressionPrefix="CurrentPage" type="N2.Web.Compilation.CurrentPageExpressionBuilder, N2"/> <add expressionPrefix="StartPage" type="N2.Web.Compilation.StartPageExpressionBuilder, N2"/> <add expressionPrefix="Code" type="N2.Web.Compilation.CodeExpressionBuilder, N2"/> <add expressionPrefix="HasValue" type="N2.Web.Compilation.HasValueExpressionBuilder, N2"/> </expressionBuilders> </compilation> <!-- The <authentication> section enables configuration of the security authentication mode used by ASP.NET to identify an incoming user. --> <authentication mode="Forms"> <forms name=".CommunityServer" protection="All" timeout="600000" loginUrl="login.aspx" slidingExpiration="true"/> </authentication> <customErrors mode="Off" defaultRedirect="~/error.htm"> <error statusCode="404" redirect="~/error-notfound.aspx"/> </customErrors> <pages validateRequest="false" enableEventValidation="false" autoEventWireup="true" pageBaseType="CommunityServer.Components.CSPage, CommunityServer.Components"> <controls> <add tagPrefix="n2" namespace="N2.Web.UI.WebControls" assembly="N2"/> <add tagPrefix="n2" namespace="N2.Templates.Web.UI.WebControls" assembly="N2.Templates"/> <add tagPrefix="CSControl" namespace="CommunityServer.Controls" assembly="CommunityServer.Controls"/> <add tagPrefix="CSBlog" namespace="CommunityServer.Blogs.Controls" assembly="CommunityServer.Blogs"/> <add tagPrefix="CSForum" namespace="CommunityServer.Discussions.Controls" assembly="CommunityServer.Discussions"/> <add tagPrefix="CSMail" namespace="CommunityServer.MailGateway.MailRoom.Controls" assembly="CommunityServer.MailGateway"/> <add tagPrefix="CSMedia" namespace="CommunityServer.MediaGalleries.Controls" assembly="CommunityServer.MediaGalleries"/> <add tagPrefix="CSDynConfig" namespace="Telligent.DynamicConfiguration.Controls" assembly="Telligent.DynamicConfiguration"/> <add tagPrefix="CSHub" namespace="CommunityServer.Hubs.Controls" assembly="CommunityServer.Controls"/> <add tagPrefix="CSMessage" namespace="CommunityServer.Messages.Controls" assembly="CommunityServer.Messages"/> <add tagPrefix="CSWiki" namespace="CommunityServer.Wikis.Controls" assembly="CommunityServer.Wikis"/> <add tagPrefix="TWC" namespace="Telligent.Glow" assembly="Telligent.Glow"/> <add tagPrefix="TWC" namespace="Telligent.Glow" assembly="Telligent.Glow.MultipleFileUpload"/> <add tagPrefix="CP" namespace="CommunityServer.ControlPanel.Controls" assembly="CommunityServer.Web"/> <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> <add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> </controls> <tagMapping> <add tagType="System.Web.UI.HtmlControls.HtmlForm" mappedTagType="N2.Web.UI.WebControls.RawUrlForm"/> </tagMapping> </pages> <httpHandlers> <remove verb="*" path="*.asmx"/> <add path="*.n2.ashx" verb="*" type="N2.Web.AjaxRequestHandler, N2"/> <add verb="GET" path="Utility/redirect.aspx" type="CommunityServer.Components.Redirect, CommunityServer.Components"/> <add verb="GET" path="aggbug.aspx" type="CommunityServer.Components.HttpHandler.AggBugHandler, CommunityServer.Components"/> <add verb="GET" path="avatar.aspx" type="CommunityServer.Components.HttpHandler.AvatarHttpHandler, CommunityServer.Components"/> <add verb="GET" path="vcard.aspx" type="CommunityServer.Components.HttpHandler.VCardHttpHandler, CommunityServer.Components"/> <add verb="GET" path="r.ashx" type="CommunityServer.Components.HttpHandler.TinyUrlHttpHandler, CommunityServer.Components"/> <add verb="GET" path="weblogsubscription-confirmation.ashx" type="CommunityServer.Blogs.Components.WeblogSubscriptionConfirmation, CommunityServer.Blogs"/> <add verb="GET" path="threadsubscription-confirmation.ashx" type="CommunityServer.Blogs.Components.ThreadSubscriptionConfirmation, CommunityServer.Blogs"/> <add verb="GET" path="cfs-file.ashx" type="CommunityServer.Components.FileHttpHandler, CommunityServer.Components"/> <add verb="GET" path="cfs-filesystemfile.ashx" type="CommunityServer.Components.FileSystemFileStorageHttpHandler, CommunityServer.Components"/> <add verb="GET" path="resized-image.ashx" type="CommunityServer.Components.ImageFileResizerHttpHandler, CommunityServer.Components"/> <add verb="GET,POST" path="multipleupload.ashx" type="Telligent.Glow.MultipleUploadFileHandler, Telligent.Glow.MultipleFileUpload"/> <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/> </httpHandlers> <httpModules> <add name="n2.initializer" type="N2.Web.InitializerModule, N2"/> <add name="CommunityServer" type="CommunityServer.CSHttpModule, CommunityServer.Components"/> <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> </httpModules> <trace enabled="false" requestLimit="40" localOnly="true"/> <sessionState mode="Off"/> <siteMap defaultProvider="PublicSiteMap"> <providers> <add name="PublicSiteMap" type="N2.Web.PublicSiteMapProvider, N2" startPageIsRoot="true"/> </providers> </siteMap> <membership userIsOnlineTimeWindow="15" defaultProvider="CommunityServerSqlProvider"> <providers> <clear/> <add name="CommunityServerSqlProvider" type="CommunityServer.ASPNet20MemberRole.CSMembershipProvider, CommunityServer.ASPNet20MemberRole" connectionStringName="SiteSqlServer" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="true" passwordFormat="Hashed" applicationName="dev" description="Stores and retrieves membership data from the local Microsoft SQL Server database" maxInvalidPasswordAttempts="999" passwordAttemptWindow="999" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0"/> </providers> </membership> <roleManager defaultProvider="CommunityServerSqlProvider" enabled="true" cacheRolesInCookie="true" cookieName=".CSRoles" cookieTimeout="60000" cookiePath="/" cookieRequireSSL="false" cookieSlidingExpiration="true" createPersistentCookie="true" cookieProtection="All" maxCachedResults="1000"> <providers> <clear/> <add name="CommunityServerSqlProvider" type="CommunityServer.ASPNet20MemberRole.CSRoleProvider, CommunityServer.ASPNet20MemberRole" connectionStringName="SiteSqlServer" applicationName="dev" description="Stores and retrieves roles data from the local Microsoft SQL Server database"/> </providers> </roleManager> <profile defaultProvider="CommunityServerSqlProvider" enabled="true"> <providers> <clear/> <add name="CommunityServerSqlProvider" type="CommunityServer.ASPNet20MemberRole.CSProfileProvider, CommunityServer.ASPNet20MemberRole" connectionStringName="SiteSqlServer" applicationName="dev" description="Stores and retrieves profile data from the local Microsoft SQL Server database"/> </providers> <properties> <add name="commonName" type="string"/> <add name="birthdate" type="DateTime"/> <add name="gender" type="int" defaultValue="0"/> <add name="dateFormat" type="string" defaultValue="MM-dd-yyyy"/> <add name="publicEmail" type="string"/> <add name="language" type="string"/> <add name="webAddress" type="string"/> <add name="webLog" type="string"/> <add name="webGallery" type="string"/> <add name="signature" type="string"/> <add name="signatureFormatted" type="string"/> <add name="location" type="string"/> <add name="occupation" type="string"/> <add name="interests" type="string"/> <add name="msnIM" type="string"/> <add name="yahooIM" type="string"/> <add name="aolIM" type="string"/> <add name="icqIM" type="string"/> <add name="enablePostPreviewPopup" type="System.Boolean" defaultValue="false"/> <add name="enableEmoticons" type="System.Boolean" defaultValue="true"/> <add name="timezone" type="System.Double" defaultValue="0"/> <add name="fontsize" type="int" defaultValue="0"/> <add name="bio" type="string"/> </properties> </profile> <!--<trust level="Medium" />--> <!-- ======================== Anonymous Identification ======================== anonymousIdentification configuration: enabled="[true|false]" Feature is enabled? cookieName=".ASPXANONYMOUS" Cookie Name cookieTimeout="100000" Cookie Timeout in minutes cookiePath="/" Cookie Path cookieRequireSSL="[true|false]" Set Secure bit in Cookie cookieSlidingExpiration="[true|false]" Reissue expiring cookies? cookieProtection="[None|Validation|Encryption|All]" How to protect cookies from being read/tampered domain="[domain]" Enables output of the "domain" cookie attribute set to the specified value --> <anonymousIdentification enabled="false" cookieName=".ASPXANONYMOUS" cookieTimeout="100000" cookiePath="/" cookieRequireSSL="false" cookieSlidingExpiration="true" cookieProtection="None" domain=""/> </system.web> <location path="user/EditProfile.aspx"> <system.web> <authorization> <deny users="?"/> </authorization> </system.web> </location> <system.codedom> <compilers> <compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <providerOption name="CompilerVersion" value="v3.5"/> <providerOption name="WarnAsError" value="false"/> </compiler> <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" warningLevel="4" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <providerOption name="CompilerVersion" value="v3.5"/> <providerOption name="OptionInfer" value="true"/> <providerOption name="WarnAsError" value="false"/> </compiler> </compilers> </system.codedom> <!-- The system.webServer section is required for running ASP.NET AJAX under Internet Information Services 7.0. It is not necessary for previous version of IIS. --> <system.webServer> <validation validateIntegratedModeConfiguration="false"/> <modules> <remove name="ScriptModule"/> <add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> <add name="n2.initializer" type="N2.Web.InitializerModule, N2"/> <add name="CommunityServer" type="CommunityServer.CSHttpModule, CommunityServer.Components"/> </modules> <handlers> <remove name="WebServiceHandlerFactory-Integrated"/> <remove name="ScriptHandlerFactory"/> <remove name="ScriptHandlerFactoryAppServices"/> <remove name="ScriptResource"/> <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> <add name="n" path="*.n2.ashx" verb="*" type="N2.Web.AjaxRequestHandler, N2"/> <add name="u" verb="GET" path="Utility/redirect.aspx" type="CommunityServer.Components.Redirect, CommunityServer.Components"/> <add name="a" verb="GET" path="aggbug.aspx" type="CommunityServer.Components.HttpHandler.AggBugHandler, CommunityServer.Components"/> <add name="v" verb="GET" path="avatar.aspx" type="CommunityServer.Components.HttpHandler.AvatarHttpHandler, CommunityServer.Components"/> <add name="vc" verb="GET" path="vcard.aspx" type="CommunityServer.Components.HttpHandler.VCardHttpHandler, CommunityServer.Components"/> <add name="r" verb="GET" path="r.ashx" type="CommunityServer.Components.HttpHandler.TinyUrlHttpHandler, CommunityServer.Components"/> <add name="w" verb="GET" path="weblogsubscription-confirmation.ashx" type="CommunityServer.Blogs.Components.WeblogSubscriptionConfirmation, CommunityServer.Blogs"/> <add name="t" verb="GET" path="threadsubscription-confirmation.ashx" type="CommunityServer.Blogs.Components.ThreadSubscriptionConfirmation, CommunityServer.Blogs"/> <add name="c" verb="GET" path="cfs-file.ashx" type="CommunityServer.Components.FileHttpHandler, CommunityServer.Components"/> <add name="cf" verb="GET" path="cfs-filesystemfile.ashx" type="CommunityServer.Components.FileSystemFileStorageHttpHandler, CommunityServer.Components"/> <add name="r" verb="GET" path="resized-image.ashx" type="CommunityServer.Components.ImageFileResizerHttpHandler, CommunityServer.Components"/> <add name="mu" verb="GET,POST" path="multipleupload.ashx" type="Telligent.Glow.MultipleUploadFileHandler, Telligent.Glow.MultipleFileUpload"/> </handlers> </system.webServer> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35"/> <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35"/> <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/> </dependentAssembly> </assemblyBinding> </runtime> </configuration>
![]() |
1 |
![]() |
Use
sessionstate timeout in your config file. More details can be found here at MSDN http://msdn.microsoft.com/en-us/library/ms972429.aspx
--
(Please, Mark as Answer if it Helped)
http://smsohan.blogspot.com
![]() |
1 |
![]() |
I turned session state mode to inproc and timeout to 20.
I'm still getting the error.
trying logging in with
username: testuser
password: 1234qwer
click on links and page loads fast and you stay logged in. After about 30 sec of clicking links, they page request time doubles and you get signed out.
![]() |
1 |
![]() |