Can anyone help me with the error below? I implemented it based on this link PermissionCookie
Can anyone help me with the error below? I implemented it based on this link PermissionCookie
This error happens for a very simple reason: after a certain amount of time, pre-defined on your web.config
, the cookie is deleted from the browser.
That's a bit of a precaution for your application.
But to dribble this error is simple:
Go to your web.config
in your project just add the tag <autentication>
as below.
<system.web>
<authentication mode="Forms">
<forms timeout="28" loginUrl="/Autenticacao/Index"></forms>
</authentication>
</system.web>
Explaining: timeout is the time the cookie will be active in the browser and after the time expires redirects to the login page.
As you used my question as a basis, I did not do any processing so that it would show some message to the user, but if you want to implement this idea, it would be legal. It is an alternative not to show this small screen of IIS.
This error also occurs because some user must necessarily be logged into the page where .PermisionCookie is used.
This happens because the user information is verified in that cookie that is created as soon as the Session rises in the system, that is, as soon as the user actually logs on the system . If you do not have any users logged in, the Session is not created and therefore the cookie and so this error appears because you do not know that cookie is the one that the page is requesting, and it directs the value of cookie as null .