<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: Customize application.master</title>
	<atom:link href="http://stevepietrek.com/2008/01/29/customize-applicationmaster/feed/" rel="self" type="application/rss+xml" />
	<link>http://stevepietrek.com/2008/01/29/customize-applicationmaster/</link>
	<description>My continuous learning of SharePoint, Silverlight, WP7 Development, Office, VSTO, C#...</description>
	<lastBuildDate>Tue, 24 May 2011 06:39:09 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Joel Jalbert</title>
		<link>http://stevepietrek.com/2008/01/29/customize-applicationmaster/#comment-1399</link>
		<dc:creator><![CDATA[Joel Jalbert]]></dc:creator>
		<pubDate>Tue, 19 Feb 2008 21:12:03 +0000</pubDate>
		<guid isPermaLink="false">http://stevepietrekweblog.wordpress.com/?p=191#comment-1399</guid>
		<description><![CDATA[I have code samples for you!

&lt;code&gt;

namespace CustomDesign
{
    public class CustomPageInit : IHttpModule
    {
        public void Init(HttpApplication context)
        {
            context.PreRequestHandlerExecute += new EventHandler(context_PreRequestHandlerExecute);
        }

        void context_PreRequestHandlerExecute(object sender, EventArgs e)
        {
            HttpApplication httpApp = sender as HttpApplication;

            if (httpApp != null)
            {
                Page page = httpApp.Context.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.MasterPageFile != null)
            {
                if (page.MasterPageFile.ToLower().Contains(&quot;application.master&quot;)) {

                    SPWeb objWeb = SPContext.Current.Web;

                    if (objWeb.MasterUrl.Contains(&quot;default.custom.master&quot;))
                    {
                        objWeb.AllowUnsafeUpdates = true;
                        objWeb.Update();
                        string strTmp = page.MasterPageFile.ToLower().Replace(&quot;application.master&quot;, &quot;application.custom.master&quot;);
                        page.MasterPageFile = strTmp;
                    }
                }
            }
        }

        public void Dispose()
        {
        }
    }
}
&lt;/code&gt;

In the web.config, append that line into the httpmodule section

&lt;code&gt;

&lt;/code&gt;]]></description>
		<content:encoded><![CDATA[<p>I have code samples for you!</p>
<p><code></p>
<p>namespace CustomDesign<br />
{<br />
    public class CustomPageInit : IHttpModule<br />
    {<br />
        public void Init(HttpApplication context)<br />
        {<br />
            context.PreRequestHandlerExecute += new EventHandler(context_PreRequestHandlerExecute);<br />
        }</p>
<p>        void context_PreRequestHandlerExecute(object sender, EventArgs e)<br />
        {<br />
            HttpApplication httpApp = sender as HttpApplication;</p>
<p>            if (httpApp != null)<br />
            {<br />
                Page page = httpApp.Context.CurrentHandler as Page;</p>
<p>                if (page != null)<br />
                {<br />
                    page.PreInit += new EventHandler(page_PreInit);<br />
                }<br />
            }<br />
        }</p>
<p>        void page_PreInit(object sender, EventArgs e)<br />
        {<br />
            Page page = sender as Page;</p>
<p>            if (page.MasterPageFile != null)<br />
            {<br />
                if (page.MasterPageFile.ToLower().Contains("application.master")) {</p>
<p>                    SPWeb objWeb = SPContext.Current.Web;</p>
<p>                    if (objWeb.MasterUrl.Contains("default.custom.master"))<br />
                    {<br />
                        objWeb.AllowUnsafeUpdates = true;<br />
                        objWeb.Update();<br />
                        string strTmp = page.MasterPageFile.ToLower().Replace("application.master", "application.custom.master");<br />
                        page.MasterPageFile = strTmp;<br />
                    }<br />
                }<br />
            }<br />
        }</p>
<p>        public void Dispose()<br />
        {<br />
        }<br />
    }<br />
}<br />
</code></p>
<p>In the web.config, append that line into the httpmodule section</p>
<p><code></p>
<p></code></p>
]]></content:encoded>
	</item>
</channel>
</rss>

