I’m building a .net web app and using Forms authentication with cookies to remember if the user is signed in or not:
<authentication mode="Forms">
<forms timeout="4320" cookieless="UseCookies" loginUrl="~/account.aspx" name="test" slidingExpiration="true" />
</authentication>
But after building, changing the web.config or doing an IIS reset, the first page I load shows I am not signed in. But if I refresh the page again it then shows I’m signed in, even if I didn’t do anything.
So it seems it remembers I was signed in, but only after the first page load.
Is that usual? Do I have something misconfigured in the web.config? Is this a localhost issue only?
Ok, this was my own bonehead fault of course. Turns out in my web.config I had the setting:
The problem is that appSettings.config didn’t exist in my project. After I removed this line (it was from boilerplate code and didn’t need it), it worked find.
So apparently on the first load .net was angry about this file not existing as it was trying to load up the config for the first time, but after the first load it didn’t care anymore (that’s about as technical as I can get).