navigation
 Monday, June 23, 2008

I recently had some trouble getting the "Remember me" check box that comes built into the ASP.NET Login control to work as advertised. A quick Google search revealed that this is a pretty common occurrence with multiple possible causes, but the one that probably gets people the most is neglecting to set the cookie timeout. If you don't, the default is a cookie that lasts for only 30 minutes. Below is a sample that will create a cookie that lasts for 30 days from the most recent login and automatically renews itself.

<authentication mode="Forms">
    <forms
        cookieless="UseCookies"
        defaultUrl="Login.aspx"
        loginUrl="Login.aspx"
        name=".your_webapp_name_here.aspxauth"
        slidingExpiration="true"
        timeout="43200">
    </forms>
</authentication>
Name
E-mail
Home page

Comment (Some html is allowed: a@href@title, i, strike, u) where the @ means "attribute." For example, you can use <a href="" title=""> or <blockquote cite="Scott">.  

Enter the code shown (prevents robots):

Live Comment Preview