Add sign out functionality to link

Alan Isaacson asked on November 23, 2016 11:58

I have a set of links in the header of my site which are listed as Content within a Static web part. The line I have added for logout works if I also have a logout link on the page but not if it is on its own like this; <li class="vs-action-list__item"> <a id="p_lt_ctl00_SignOutButton_btnSignOutLink" class="signoutLink" href="javascript:__doPostBack(&#39;p$lt$ctl00$SignOutButton$btnSignOutLink&#39;,&#39;&#39;)"><i class="fa fa-sign-in" aria-hidden="true"></i><span class="text">Logout</span></a> </li> Is there something else I need to add to the page to ensure this works correctly?

Correct Answer

Roman Hutnyk answered on November 23, 2016 13:01

It works when sign out button is present because your link does exactly the same postback as sign out button:

href="javascript:__doPostBack(&#39;p$lt$ctl00$SignOutButton$btnSignOutLink&#39;,&#39;&#39;)

When web part is not present on the page the is nothing that could handle postback above.

You can either implement custom aspx page that will perform sign out on page load and make your link to redirect to that page.

In case you're using editable text to place your link in consider creation of a custom widget base on Sign Out Button web part.

0 votesVote for this answer Unmark Correct answer

Recent Answers


Alan Isaacson answered on November 23, 2016 13:41

Thanks Roman, I was over complicating the process, I didn't even realise the button changed between login and logout automatically. By the way having met in Vegas can you update you picture on here as promised!

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.