Hi.. This is my first blog post. I've been finding solution for months for this problem. Normally SharePoint handles the sign out process automatically if the authentication mode is Claim based. But when it comes to Form based authentication or mixed mode authentication it cause some problems.
I experienced when user is going to Sign out from the site it will redirect to Error page. The problem is with the SharePoint itself. Problem occurs when SharePoint is redirecting to "_layouts/SignOut.aspx" page without clearing Cookies and Session objects.
This problem can solve with introducing new user control(web part) to your solution. This user control can place on your master page.
After adding the Application page add this code in the page itself. Application page will placed in 15 hive.
This will do the trick for Form based authentication sign out. From the web part early created you should call this page. link should as follows.
I referance this blog post from Tobias Lekman. It helps me a lot. Thanks.
I experienced when user is going to Sign out from the site it will redirect to Error page. The problem is with the SharePoint itself. Problem occurs when SharePoint is redirecting to "_layouts/SignOut.aspx" page without clearing Cookies and Session objects.
This problem can solve with introducing new user control(web part) to your solution. This user control can place on your master page.
<asp:HyperLink ID="HyperLinkSignOut" CssClass="noBorder" runat="server" NavigateUrl="../../../../_layouts/15/SampleSignOutSolution/Signout.aspx">Sign Out</asp:HyperLink>you can use either button, link button or hyperlink. In my solution im using another Application page. You can simply create it by adding application page for your solution. following image shows how to add application page.
| Add Application Page |
After adding the Application page add this code in the page itself. Application page will placed in 15 hive.
| Page_Load() event of Application Page |
| Function that called by Application Page Page_Load() |
This will do the trick for Form based authentication sign out. From the web part early created you should call this page. link should as follows.
"/_layouts/15/YourSolutionName/YourApplicaitonPageName.aspx"If your system has mixed mode(Form based & Claim based) you can add another link to previous web part to sign out claim based users also. this is pretty much easy.
<asp:HyperLink ID="HyperLinkInternalUsersSignOut" CssClass="noBorder" Visible="true" runat="server" NavigateUrl="/_layouts/SignOut.aspx">Internal Sign out</asp:HyperLink>That's all. Hope this will help to resolve the sign out problem with form based authentication. Thank you.
I referance this blog post from Tobias Lekman. It helps me a lot. Thanks.