<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Quinterox &#187; masterpagefile</title>
	<atom:link href="http://www.quinterox.com/content/tag/masterpagefile/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.quinterox.com/content</link>
	<description>Cesar Quinteros</description>
	<lastBuildDate>Sun, 20 Jun 2010 04:51:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Changing MasterPageFile</title>
		<link>http://www.quinterox.com/content/code/changing-masterpagefile/</link>
		<comments>http://www.quinterox.com/content/code/changing-masterpagefile/#comments</comments>
		<pubDate>Fri, 15 Aug 2008 06:05:22 +0000</pubDate>
		<dc:creator>Cesar Quinteros</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[asp]]></category>
		<category><![CDATA[masterpage]]></category>
		<category><![CDATA[masterpagefile]]></category>

		<guid isPermaLink="false">http://quinterox.com/code/?p=23</guid>
		<description><![CDATA[This snippet is from a web app I was developing in ASP.NET that had to have the ability to switch skins upon the administrator's command.]]></description>
			<content:encoded><![CDATA[<h2>Snippet-Admin/Default.aspx</h2>
<p>I added this code to my admin files to enable me to change masterfilepages on the fly. I tried with global variables and with properties but my masterpagefile would always default back the hardcoded file somehow.</p>
<pre>
Private Function changeTheme(ByVal strNewThemePath As String) As String
        If File.Exists(Server.MapPath(strNewThemePath)) Then
            Application.Set("theme", strNewThemePath)
            Return String.Format("Theme changed successfully to: ""{0}""", strNewThemePath)
        Else
            Return String.Format("The file: ""{0}"" does not exist. Theme not changed.", strNewThemePath)
        End If
End Function
</pre>
<h2>Snippet-Global.asax</h2>
<p>I also added this to the global.asax file since the code above did not specify a default theme.</p>
<pre>    Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
        'If no other theme is chosen then load the default
        If Application("theme") Is Nothing Then
            Dim Config As New Config
            Application("theme") = Config.strDefaultTheme
        End If
    End Sub</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.quinterox.com/content/code/changing-masterpagefile/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
