I have SharePoint web application. Need to redirect to custom login page after session timeout.
Where is the exact location in web.config file to do this redirection or any code behind file or login.aspx.cs file can I do it?
I think the defualt asp.net web.config can do it as below.
<authentication mode="Forms">
<forms defaultUrl="~/Default.aspx"
loginUrl="~/Login.aspx"
slidingExpiration="true"
timeout="60" />
</authentication>
I have found that there are many more session state timeouts in web.config. What exactly should I change to change the session timeout?
<system.web>
<sessionState mode="SQLServer" timeout="60" allowCustomSqlDatabase="true" sqlConnectionString="Data Source=91.1.1.1;Initial Catalog=SP_SessionState;Integrated Security=True;Enlist=False;Pooling=True;Min Pool Size=0;Max Pool Size=100;Connect Timeout=15" />
</system.web>
and also I found another timeout.
<pages enableSessionState="false" enableViewState="true" enableViewStateMac="true" validateRequest="false" clientIDMode="AutoID" pageParserFilterType="Microsoft.SharePoint.ApplicationRuntime.SPPageParserFilter, Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" asyncTimeout="7">
And also there are many aspx session timeouts in web.config.
<location path="_layouts/UploadEx.aspx">
<system.web>
<httpRuntime maxRequestLength="2097151" executionTimeout="3600" />
</system.web>
</location>
<location path="_layouts/15/UploadEx.aspx">
<system.web>
<httpRuntime maxRequestLength="2097151" executionTimeout="3600" />
</system.web>
</location>
<location path="_layouts/NewVideoSet.aspx">
<system.web>
<httpRuntime maxRequestLength="2097151" executionTimeout="3600" />
</system.web>
</location>
Currently I have a custom login page under _layouts/mysite/login.aspx directory. Currently if my session expired it goes to SharePoint default error page,then I need to clear the cache again to go for the login page.
Might be the reason of which I have used HttpContext.Current.Session["CustomSessionName"] variables in login page as well as in other pages. Do I need to remove the session varibales used in code?
Any idea how to avoid from this and need to redirect to login page when user refresh the page after the http session timeout.