locked
sharepoint customizing signout.aspx RRS feed

  • Question

  • i want to redirect to my default.aspx page when i signout using system account in sharepoint...is their any way to do this ? thanks...
    Wednesday, October 7, 2009 4:59 AM

All replies

  • Hi talhak,

    To do this, edit the file at C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\signout.aspx.

    You will need to replace the following code with a redirect:

    function _spBodyOnLoad()
    [
       try
       [
          document.execCommand("ClearAuthenticationCache");
       ]
       catch (e) []
       window.close();
    ]

    remove the window.close(); and change the information in the try/catch block to a response.redirect or window.location, etc.

    Best of luck!

    --Brett
    Hosting.com

    Moderator Note: NEVER propose your own posts as answers. The "Propose as Answer" function is provided for people to propose the good answers of other people. It is not there for self-proposing.

    • Proposed as answer by bbolling_hosting.com Saturday, October 10, 2009 4:40 PM
    • Unproposed as answer by Mike Walsh FIN Thursday, February 24, 2011 8:32 AM
    • Edited by Mike Walsh FIN Thursday, February 24, 2011 8:33 AM Moderator Note on not self-proposing added
    • Proposed as answer by pvsavsg Thursday, August 25, 2011 10:42 AM
    Thursday, October 8, 2009 5:17 PM
  • hey brett thanks for replying i applied the above code in the signout.aspx which looks like this now...but when i signout im getting an unknown error i tried window.location and the redirect with and without quotes also im still getting the same error...am i doing something wrong ?

    ------------------------------------------------------------------------------------------------------------------------------------

    <%@ Assembly Name="Microsoft.SharePoint.ApplicationPages, Version=12.0.0.0, Culture=neutral,

    PublicKeyToken=71e9bce111e9429c"%> <%@ Page Language="C#" Inherits="Microsoft.SharePoint.ApplicationPages.SignOutPage"

    MasterPageFile="~/_layouts/simple.master"      %> <%@ Import Namespace="Microsoft.SharePoint.ApplicationPages" %> <%@

    Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint,

    Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="Utilities"

    Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral,

    PublicKeyToken=71e9bce111e9429c" %> <%@ Import Namespace="Microsoft.SharePoint" %>
    <%response.redirect (/default.aspx)%>



    function _spBodyOnLoad()
    {
       try
       {
          document.execCommand("ClearAuthenticationCache");
       }
       catch (e) { }
       //window.close();
       window.location("/default.aspx");
    }

    <asp:Content ContentPlaceHolderId="PlaceHolderPageTitle" runat="server">
        <SharePoint:EncodedLiteral runat="server" text="<%$Resources:wss,signout_pagetitle%>" EncodeMethod='HtmlEncode'/>
    </asp:Content>
    <asp:Content ContentPlaceHolderId="PlaceHolderPageTitleInTitleArea" runat="server">
        <SharePoint:EncodedLiteral runat="server" text="<%$Resources:wss,signout_pagetitle%>" EncodeMethod='HtmlEncode'/>
    </asp:Content>
    <asp:Content contentplaceholderid="PlaceHolderPageImage" runat="server">
        <img id="onetidtpweb1" src="/_layouts/images/error.gif" alt="" />
    </asp:Content>
    <asp:content contentplaceholderid="PlaceHolderAdditionalPageHead" runat="server">
    </asp:Content>
    <asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server">
        <asp:Label id="lbPageDescription" Text="<%$Resources:wss,signout_pagedescription%>" runat="server"/>
    </asp:Content>

    ---------------------------------------------------------------------------------------------------------------------------------------------



    Friday, October 9, 2009 4:24 AM
  • <%response.redirect (/default.aspx)%>
    
    function _spBodyOnLoad()
    {
       try
       {
          document.execCommand("ClearAuthenticationCache");
       }
       catch (e) { }
       //window.close();
       window.location("/default.aspx");
    }


    Talhak,

    This section of code looks to have 2 attempts to redirect going on at the same time. Both of which have slightly invalid syntax.  For JS redirect you will us

    window.location = "/default.aspx";

    For the .Net redirect your syntax should be

    <%Response.Redirect("/default.aspx");%>


    The .net code will need to be wrapped in <% ... %> but the quotes are necessary. Keep the redirect code after the try/catch block in this case so that the session does in fact get logged out.

    --Brett
    Infra Tech II
    http://www.hosting.com/
    • Proposed as answer by pvsavsg Thursday, August 25, 2011 10:43 AM
    Friday, October 9, 2009 1:39 PM
  • Brett,

    i tried the above code u told me but i think sharepoint needs to close the window in order to signout, the above code is working but it doesnt sign out properly when i refresh the "default.aspx" it doesnt ask for a password so im thinking that it doesnt sign out just refreshes the default.aspx...i might be rite ? or is their any other solution to this...thanks...
    Monday, October 12, 2009 4:23 AM
  • Talhak,

    Just to confirm, you still have the try/catch block with the "document.execCommand("ClearAuthenticationCache");" command, right? Verify that your redirect occurs after this code executes otherwise you will be redirected prior to the Auth Session being cleared.

    --Brett
    Infra Tech II
    http://www.hosting.com/
    Tuesday, October 13, 2009 12:39 PM
  • Brett,


    im unable to solve this problem ive tried almost everything in my knowledge but im unable to signout sucessfully...it just keeps on refreshing the page....can u plz tell me exactly where shud i put this code...thanx
    Wednesday, October 14, 2009 5:48 AM
  • Hi talhak,

    try this:

    (make sure you have not done any changes else than this)

     

    //Replace the specified "PlaceHolderAdditionalPageHead" tag with the following tag

     

     

    <asp:content contentplaceholderid="PlaceHolderAdditionalPageHead" runat="server">
    
    <script type="text/javascript" language="JavaScript">
    
    document.execCommand("ClearAuthenticationCache");
    
            window.location = "/Pages/Default.aspx";//for "collaboration" site template
    
    //window.location = "/Default.aspx";//for "Team site" site template 
    
    </script> 
    
    </asp:content>

     

    hope this helps...
    Regards,
    Sudheer

     


    • Proposed as answer by pvsavsg Thursday, August 25, 2011 10:43 AM
    • Edited by pvsavsg Thursday, August 25, 2011 10:44 AM highliting code
    Thursday, February 24, 2011 5:19 AM