In my web.config file i have the following code:
<system.web>
<authentication mode="Forms">
<forms loginUrl="/Account/Login" slidingExpiration="true" timeout="1" />
</authentication>
<sessionState timeout="1"></sessionState>
</system.web>
And I have main page Project and in that there will sub pages. I have given the [Authorize] attribute for each view index method.
After the session complete when we select any view then the page inside the project main page will be redirecting. But I want the whole page to be redirected.
Any Help is appreciated.
Your web.config should look like the one below.
the
<authentication>element should be under<system.web>and not<assemblies>. The rest things you are doing it correctly i.e by putting[Authorize]attribute on method/action.When the session expiries and a request is made for that action the loginUrl will be used and the user will be redirected to the login page. Hope this helps.