Share via


Как заменить application.master на собственный на всем портале SharePoint

???? ???????? ??????????? ? ???, ??? ???? ????????? ?????????? application.master “??????” ?? Web ?????????? SharePoint, ?? ????????? ???????? ??????? ?????????? ??????? (??? ????????, ??????? ? ????? LAYOUTS) ? ??????? ?????????? master page ?? ????? ???????????.

 

?????? ????? ???????? ????? ????????? ???????:

 

1. ??????????? application.master ? ?????? ? ???? ??????????? ?????????. ??? ???? ?????? ??????? ?? ???????? ?? ?????? contentplaceholder'?.

??????????? application.master, ?????????????? ?? ??????? ?? ????????? ????????? ?? ????????? ????? ? ????? \Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS.

2. ??????? ????, ??????? ????? ?????????????? masterpage ?? ?????? ? Master Page Gallary. ??? ??? ???????? ?????? ?????.

3. ??????????? HttpHandler

????????? Visual Studio 2005. ??????? ??? ?????? ? ?????, ?????????? ??????????:

namespace Samples.Modules

{

    /// <summary>

    /// ?????? ??? ??????????????? master.page ??? ????????? ???????

    /// </summary>

  public class MasterPageModule : IHttpModule

    {

        public void Init(HttpApplication context)

        {

            context.PreRequestHandlerExecute += new EventHandler(context_PreRequestHandlerExecute);

        }

        void context_PreRequestHandlerExecute(object sender, EventArgs e)

        {

            Page page = HttpContext.Current.CurrentHandler as Page;

            if (page != null)

            {

                page.PreInit += new EventHandler(page_PreInit);

            }

        }

void page_PreInit(object sender, EventArgs e)

        {

            Page page = sender as Page;

            if (page != null)

            {

                // Is there a master page defined?

                if (page.MasterPageFile != null)

                {

  // only change the application.master files as those are the offenders

                    if (page.MasterPageFile.Contains("application.master"))

                        page.MasterPageFile = "/_catalogs/masterpage/ sample_application.master";

                }

            }

        }

        public void Dispose()

        {

        }

 }

????? ????????? web.config ? ??????????? ???? ??? Handler

<httpModules>

  <add name="AppMasterHandlerModule" type=" Samples.Modules.MasterPageModule, Samples, Version=1.0.0.0, Culture=neutral, PublicKeyToken=c5bb9526235c6eae" />

    </httpModules>

?????? ?? ???? ??????? ????? ???????? ??? ????????????????? masterpage

Comments

  • Anonymous
    January 01, 2003
    Создать свой masterpage и сделать его используемым по-умолчанию. Или изменить  default.master.

  • Anonymous
    September 19, 2007
    Каким образом можно просто убрать правую зону вебчастей на главной странице портала MOSS?

  • Anonymous
    March 15, 2008
    А у меня "Неизвестная Ошибка" вылезает...