views:

40

answers:

1

Hi have form authenticaion for my site, and it works fine on localhost and godaddy, but after moving to another hosting it stop working. After login in admin area after 2-3 minutes I redirecting back to login screen. Does anybody know if I change some settings on IIS or what is the source of the problem? My code looks like

<authentication mode="Forms">
<forms loginUrl="~/Account/LogOn" timeout="10000" slidingExpiration="true"/>
</authentication>


FormsAuthentication.SetAuthCookie(userName, rememberMe);
+1  A: 

If your application domain is being shut down and you have no machineKey section in Web.config (or validationKey/decryptionKey="AutoGenerate") you will get new validationKey/decriptionKey after every application start and authentication cookies will become invalid. Visit http://aspnetresources.com/tools/keycreator.aspx and add generated machineKey section into your Web.config.

eu-ge-ne
Yes you are righth. It works for me :))
Alexander Shapovalov