<?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>MyLifeBBS &#187; Request URL</title>
	<atom:link href="http://www.mylifebbs.com/tag/request-url/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mylifebbs.com</link>
	<description>The World without Boundaries</description>
	<lastBuildDate>Sat, 05 Jun 2010 14:17:14 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Show DNN Module in Another Module&#8217;s Generated Page.</title>
		<link>http://www.mylifebbs.com/2009/12/show-dnn-module-in-another-modules-generated-page/</link>
		<comments>http://www.mylifebbs.com/2009/12/show-dnn-module-in-another-modules-generated-page/#comments</comments>
		<pubDate>Sat, 26 Dec 2009 01:34:20 +0000</pubDate>
		<dc:creator>George</dc:creator>
				<category><![CDATA[DotNetNuke]]></category>
		<category><![CDATA[Request URL]]></category>
		<category><![CDATA[Show Module only specific page]]></category>

		<guid isPermaLink="false">http://www.mylifebbs.com/2009/12/show-dnn-module-in-another-modules-generated-page/</guid>
		<description><![CDATA[One of the greatest feature of DotNetNuke is to allow use to show the module in the page they like based on the viewer’s role and permission. However, this only apply to DotNetNuke generated pages. So, how about showing a module only in a page that is generated by Blog Module for example?
The solution is [...]


Related posts:<ol><li><a href='http://www.mylifebbs.com/2009/01/dotnetnuke-custom-error-page-404-page-not-found-redirection/' rel='bookmark' title='Permanent Link: DotNetNuke Custom Error Page, 404 Page Not Found Redirection'>DotNetNuke Custom Error Page, 404 Page Not Found Redirection</a></li>
<li><a href='http://www.mylifebbs.com/2010/01/guide-to-implement-re-captcha-in-dotnetnuke-modules-without-touching-the-source-code/' rel='bookmark' title='Permanent Link: Guide to implement re-Captcha in DotNetNuke Modules without touching the source code.'>Guide to implement re-Captcha in DotNetNuke Modules without touching the source code.</a></li>
<li><a href='http://www.mylifebbs.com/2009/05/making-dotnetnuke-logo-link-seo-friendly/' rel='bookmark' title='Permanent Link: Making DotNetNuke Logo Link SEO Friendly!'>Making DotNetNuke Logo Link SEO Friendly!</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>One of the greatest feature of DotNetNuke is to allow use to show the module in the page they like based on the viewer’s role and permission. However, this only apply to DotNetNuke generated pages. So, how about showing a module only in a page that is generated by Blog Module for example?</p>
<p>The solution is simple, all you need to do is add the following lines into your skin.ascx file:</p>
<p> <span id="more-282"></span>
<div style="border-bottom: gray 1px solid; border-left: gray 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; max-height: 200px; font-size: 8pt; overflow: auto; border-top: gray 1px solid; cursor: text; border-right: gray 1px solid; padding-top: 4px">
<div style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&lt;% <span style="color: #0000ff">If</span> Regex.IsMatch (Request.URL.ToString, <span style="color: #006080">&quot;REGEX HERE&quot;</span>) <span style="color: #0000ff">Then</span> %&gt;</pre>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&lt;div id=<span style="color: #006080">&quot;ExtraPane&quot;</span> runat=<span style="color: #006080">&quot;server&quot;</span>&gt;&lt;/div&gt;</pre>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&lt;% <span style="color: #0000ff">End</span> <span style="color: #0000ff">If</span> %&gt;</pre>
</p></div>
</div>
<p>The idea is to show a module pane only when a specific page is called. In the above example, we use ASP.NET Regex to match with the requested URL with the self defined Regex value “REGEX HERE”.</p>
<p>Using Ventrian’s Article Module for example, the default URL of a Article Page looks something like this:<br />
  <br /><em>http://www.example.com/NewsArticles/tabid/218/articleType/<strong>ArticleView</strong>/articleId/384/Example-Page.aspx</em></p>
<p>In the url above, we can easily identify the unique parameter of the module’s generated url: <em><strong>ArticleView, </strong></em>we use this as the Regex filter and replace it with&#160; “REGEX HERE” and you have this:</p>
<div style="border-bottom: gray 1px solid; border-left: gray 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; max-height: 200px; font-size: 8pt; overflow: auto; border-top: gray 1px solid; cursor: text; border-right: gray 1px solid; padding-top: 4px">
<div style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&lt;% <span style="color: #0000ff">If</span> Regex.IsMatch (Request.URL.ToString, <span style="color: #006080">&quot;ArticleView&quot;</span>) <span style="color: #0000ff">Then</span> %&gt;</pre>
</p></div>
</div>
<p>If you worry you might have the word “ArticleView” word in other pages’ URL, you could put a longer regex value to filter it:&#160; &amp;tabid=218&amp;ArticleView=</p>
<p><strong>Important Note:</strong> The “Request.URL.ToString” calls the raw url which looks like this:</p>
<p><em>Default.aspx?TabId=88&amp;ArticleView=</em></p>
<p><strong></strong></p>
<p>Thus, your Regex Value must match with the raw url and not the Human Friendly Url that you see in the web browser.</p>
<p>If you do not know the raw url of the module generated page’s url, you could add this into your skin file to find it out:</p>
<div style="border-bottom: gray 1px solid; border-left: gray 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; max-height: 200px; font-size: 8pt; overflow: auto; border-top: gray 1px solid; cursor: text; border-right: gray 1px solid; padding-top: 4px">
<div style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&lt;!-- &lt;%= Request.URL.ToString %&gt; --&gt;</pre>
</p></div>
</div>
<p>Note: &lt;!&#8211;&#160;&#160; &#8211;&gt; is added so that it will not show in the normal view but you can see it via browser’s view page source function. This is to avoid interference in production site.</p>
<p>For a live demonstration, you can see this page:<br />
  <br /><em>http://www.goeatout.com.my/Restaurants/Promotions.aspx</em> and</p>
<p><em>http://www.goeatout.com.my/Restaurants/Promotions/Details/View/PID/31315/Hong-La-Qiao-Restaurant-Steamboat-Buffet.aspx</em></p>
<p>In the second link, a module “More Related Dining Promotions” is added at the page bottom which only shows in the page with “PID” in the URL but not in any of it’s parent page <em>/Promotions/</em></p>
<p>For advanced combination, you could add “AND” in the code:</p>
<div style="border-bottom: gray 1px solid; border-left: gray 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; max-height: 200px; font-size: 8pt; overflow: auto; border-top: gray 1px solid; cursor: text; border-right: gray 1px solid; padding-top: 4px">
<div style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&lt;% <span style="color: #0000ff">If</span> Regex.IsMatch (Request.URL.ToString, <span style="color: #006080">&quot;REGEX HERE&quot;</span>) <span style="color: #0000ff">AND</span> DotNetNuke.Security.PortalSecurity.IsInRoles(PortalSettings.AdministratorRoleName) <span style="color: #0000ff">Then</span> %&gt;</pre>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        &lt;div id=<span style="color: #006080">&quot;ExtraPane&quot;</span> runat=<span style="color: #006080">&quot;server&quot;</span>&gt;&lt;/div&gt;</pre>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&lt;% <span style="color: #0000ff">End</span> <span style="color: #0000ff">If</span> %&gt;</pre>
</p></div>
</div>
<p>In the example above, it will show the extra pane only if the request url is match with your regex and the viewer has administrator role.</p>
<p>Have fun^^</p>


<p>Related posts:<ol><li><a href='http://www.mylifebbs.com/2009/01/dotnetnuke-custom-error-page-404-page-not-found-redirection/' rel='bookmark' title='Permanent Link: DotNetNuke Custom Error Page, 404 Page Not Found Redirection'>DotNetNuke Custom Error Page, 404 Page Not Found Redirection</a></li>
<li><a href='http://www.mylifebbs.com/2010/01/guide-to-implement-re-captcha-in-dotnetnuke-modules-without-touching-the-source-code/' rel='bookmark' title='Permanent Link: Guide to implement re-Captcha in DotNetNuke Modules without touching the source code.'>Guide to implement re-Captcha in DotNetNuke Modules without touching the source code.</a></li>
<li><a href='http://www.mylifebbs.com/2009/05/making-dotnetnuke-logo-link-seo-friendly/' rel='bookmark' title='Permanent Link: Making DotNetNuke Logo Link SEO Friendly!'>Making DotNetNuke Logo Link SEO Friendly!</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.mylifebbs.com/2009/12/show-dnn-module-in-another-modules-generated-page/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
