<?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>ASP.NET Tutorials &#187; Tutorials</title>
	<atom:link href="http://www.tutorialsasp.net/category/tutorials/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.tutorialsasp.net</link>
	<description>Get stuff done with ASP.NET</description>
	<lastBuildDate>Tue, 31 Aug 2010 17:23:53 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2</generator>
		<item>
		<title>Build a 3 column layout using CSS, Master Pages and Themes</title>
		<link>http://www.tutorialsasp.net/tutorials/build-a-3-column-layout-using-css-master-pages-and-themes/</link>
		<comments>http://www.tutorialsasp.net/tutorials/build-a-3-column-layout-using-css-master-pages-and-themes/#comments</comments>
		<pubDate>Tue, 18 Aug 2009 17:25:41 +0000</pubDate>
		<dc:creator>Vihutuo</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[3 column layout]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Master pages]]></category>
		<category><![CDATA[Themes]]></category>

		<guid isPermaLink="false">http://www.tutorialsasp.net/?p=266</guid>
		<description><![CDATA[Using ASP.Net Mater pages and themes makes it very easy to give a consistent layout and feel for the entire site. The 3 column fixed layout is a common design for most sites. I reuse the following code most of the time to create a 3 column layout which works in most browsers including FF2, [...]]]></description>
			<content:encoded><![CDATA[<p>Using ASP.Net Mater pages  and themes makes it very easy to give a consistent layout and feel for the entire site. The 3 column fixed layout is a common design for most sites. I reuse the following code most of the time to create a 3 column layout which works in most browsers including FF2, FF3, IE6 and IE7. All the code for design and layout are placed in a css file under the Themes folder</p>
<div id="attachment_271" class="wp-caption alignnone" style="width: 510px"><a href="http://www.tutorialsasp.net/wp-content/uploads/2009/08/3column.jpg"><img class="size-full wp-image-271" title="3column" src="http://www.tutorialsasp.net/wp-content/uploads/2009/08/3column.jpg" alt="3 column layout" width="500" height="248" /></a><p class="wp-caption-text">3 column layout</p></div>
<p>Here is the code for the master page. It is simple . It contains 3 columns with a center content area and a footer at the bottom.</p>
<p><strong>Code for Master Page</strong></p>
<pre><!--[if gte mso 9]><xml>
 <w:WordDocument>
  <w:View>Normal</w:View>
  <w:Zoom>0</w:Zoom>
  <w:Compatibility>
   <w:BreakWrappedTables />
   <w:SnapToGridInCell />
   <w:WrapTextWithPunct />
   <w:UseAsianBreakRules />
  </w:Compatibility>
  <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
 </w:WordDocument>
</xml><![endif]--><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&lt;</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">body</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&gt;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span style="color: blue;">&lt;</span><span style="color: maroon;">form</span> <span style="color: red;">id</span><span style="color: blue;">="form1"</span> <span style="color: red;">runat</span><span style="color: blue;">="server"&gt;</span></span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>    </span><span style="color: blue;">&lt;</span><span style="color: maroon;">div</span> <span style="color: red;">id</span><span style="color: blue;">="body_area"&gt;</span></span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>        </span><span style="color: blue;">&lt;</span><span style="color: maroon;">div</span> <span style="color: red;">id</span><span style="color: blue;">="left"&gt;</span></span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>              </span><span style="color: blue;">&lt;</span><span style="color: maroon;">div</span> <span style="color: red;">class</span><span style="color: blue;">="InnerText"&gt;</span></span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>                  </span><span style="color: blue;">&lt;</span><span style="color: maroon;">div</span> <span style="color: red;">id</span><span style="color: blue;">="logo"&gt;</span></span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>                  </span><span style="color: blue;">&lt;/</span><span style="color: maroon;">div</span><span style="color: blue;">&gt;</span></span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>                  </span><span style="color: blue;">&lt;</span><span style="color: maroon;">div</span> <span style="color: red;">class</span><span style="color: blue;">="Nav"&gt;</span></span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>                        </span><span style="color: blue;">&lt;</span><span style="color: maroon;">ul</span> <span style="color: red;">class</span><span style="color: blue;">="Nav"&gt;</span></span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>                              </span><span style="color: blue;">&lt;</span><span style="color: maroon;">li</span><span style="color: blue;">&gt;&lt;</span><span style="color: maroon;">a</span> <span style="color: red;">href</span><span style="color: blue;">=""&gt;</span>Link1<span style="color: blue;">&lt;/</span><span style="color: maroon;">a</span><span style="color: blue;">&gt;&lt;/</span><span style="color: maroon;">li</span><span style="color: blue;">&gt;</span></span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>                              </span><span style="color: blue;">&lt;</span><span style="color: maroon;">li</span><span style="color: blue;">&gt;&lt;</span><span style="color: maroon;">a</span> <span style="color: red;">href</span><span style="color: blue;">=""&gt;</span>Link1<span style="color: blue;">&lt;/</span><span style="color: maroon;">a</span><span style="color: blue;">&gt;&lt;/</span><span style="color: maroon;">li</span><span style="color: blue;">&gt;</span></span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>                              </span><span style="color: blue;">&lt;</span><span style="color: maroon;">li</span><span style="color: blue;">&gt;&lt;</span><span style="color: maroon;">a</span> <span style="color: red;">href</span><span style="color: blue;">=""&gt;</span>Link1<span style="color: blue;">&lt;/</span><span style="color: maroon;">a</span><span style="color: blue;">&gt;&lt;/</span><span style="color: maroon;">li</span><span style="color: blue;">&gt;</span></span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>                              </span><span style="color: blue;">&lt;</span><span style="color: maroon;">li</span><span style="color: blue;">&gt;&lt;</span><span style="color: maroon;">a</span> <span style="color: red;">href</span><span style="color: blue;">=""&gt;</span>Link1<span style="color: blue;">&lt;/</span><span style="color: maroon;">a</span><span style="color: blue;">&gt;&lt;/</span><span style="color: maroon;">li</span><span style="color: blue;">&gt;</span></span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>                         </span><span style="color: blue;">&lt;/</span><span style="color: maroon;">ul</span><span style="color: blue;">&gt;</span></span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>                  </span><span style="color: blue;">&lt;/</span><span style="color: maroon;">div</span><span style="color: blue;">&gt;</span></span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>              </span><span style="color: blue;">&lt;/</span><span style="color: maroon;">div</span><span style="color: blue;">&gt;</span></span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>       </span><span>  </span><span style="color: blue;">&lt;/</span><span style="color: maroon;">div</span><span style="color: blue;">&gt;</span></span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>           </span><span style="color: blue;">&lt;</span><span style="color: maroon;">div</span> <span style="color: red;">id</span><span style="color: blue;">="mid"&gt;</span></span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>              </span><span style="color: blue;">&lt;</span><span style="color: maroon;">div</span> <span style="color: red;">id</span><span style="color: blue;">="banner"&gt;</span></span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>              </span><span style="color: blue;">&lt;/</span><span style="color: maroon;">div</span><span style="color: blue;">&gt;</span></span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>               </span><span style="color: blue;">&lt;</span><span style="color: maroon;">div</span> <span style="color: red;">class</span><span style="color: blue;">="InnerText"&gt;</span></span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>                </span><span style="color: blue;">&lt;</span><span style="color: maroon;">asp</span><span style="color: blue;">:</span><span style="color: maroon;">contentplaceholder</span> <span style="color: red;">id</span><span style="color: blue;">="Content1"</span> <span style="color: red;">runat</span><span style="color: blue;">="server"&gt;</span></span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>                </span><span style="color: blue;">&lt;/</span><span style="color: maroon;">asp</span><span style="color: blue;">:</span><span style="color: maroon;">contentplaceholder</span><span style="color: blue;">&gt;</span></span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>               </span><span style="color: blue;">&lt;/</span><span style="color: maroon;">div</span><span style="color: blue;">&gt;</span></span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>            </span><span style="color: blue;">&lt;/</span><span style="color: maroon;">div</span><span style="color: blue;">&gt;</span></span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>       </span><span style="color: blue;">&lt;</span><span style="color: maroon;">div</span> <span style="color: red;">id</span><span style="color: blue;">="right"&gt;</span></span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>           </span><span style="color: blue;">&lt;</span><span style="color: maroon;">div</span> <span style="color: red;">class</span><span style="color: blue;">="InnerText"&gt;</span></span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>                </span>Right</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>            </span><span style="color: blue;">&lt;/</span><span style="color: maroon;">div</span><span style="color: blue;">&gt;</span></span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>      </span><span style="color: blue;">&lt;/</span><span style="color: maroon;">div</span><span style="color: blue;">&gt;</span></span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>   </span><span style="color: blue;">&lt;</span><span style="color: maroon;">div</span> <span style="color: red;">id</span><span style="color: blue;">="footer"&gt;</span></span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>     </span><span style="color: blue;">&lt;</span><span style="color: maroon;">div</span> <span style="color: red;">class</span><span style="color: blue;">="InnerText"&gt;</span></span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>           </span>footer</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>     </span><span style="color: blue;">&lt;/</span><span style="color: maroon;">div</span><span style="color: blue;">&gt;</span></span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>   </span><span style="color: blue;">&lt;/</span><span style="color: maroon;">div</span><span style="color: blue;">&gt;</span></span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>  </span><span style="color: blue;">&lt;/</span><span style="color: maroon;">div</span><span style="color: blue;">&gt;</span></span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span style="color: blue;">&lt;/</span><span style="color: maroon;">form</span><span style="color: blue;">&gt;</span></span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&lt;/</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">body</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&gt;</span></pre>
<p>Here is the CSS file which will go under the themes folder</p>
<p><strong>Code for CSS file</strong></p>
<pre><!--[if gte mso 9]><xml>
 <w:WordDocument>
  <w:View>Normal</w:View>
  <w:Zoom>0</w:Zoom>
  <w:Compatibility>
   <w:BreakWrappedTables />
   <w:SnapToGridInCell />
   <w:WrapTextWithPunct />
   <w:UseAsianBreakRules />
  </w:Compatibility>
  <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
 </w:WordDocument>
</xml><![endif]--><!--[endif]--><span style="color: #993366;">body</span>
{
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>    </span><span style="color: red;">margin</span>:<span style="color: blue;">0</span>;
</span><span>     </span><span style="color: red;">padding-top</span>:<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span style="color: blue;">0px</span>;
</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>    </span><span style="color: red;">padding-right</span>:<span style="color: blue;">0</span>;
<span>    </span><span style="color: red;">padding-bottom</span>:<span style="color: blue;">0</span>;
</span><span>     </span><span style="color: red;">padding-left</span>:<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span style="color: blue;">0</span>;
</span><span>     </span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span style="color: red;">font-family</span>:<span style="color: blue;">Arial,</span> <span style="color: blue;">Helvetica,</span> <span style="color: blue;">sans-serif</span>;
</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>    </span><span style="color: red;">background-color</span>:<span style="color: blue;">#D5CDAC</span>;
}</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">div</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">, <span style="color: maroon;">h1</span>, <span style="color: maroon;">h2</span>, <span style="color: maroon;">h3</span>, <span style="color: maroon;">h4</span>, <span style="color: maroon;">p</span>, <span style="color: maroon;">form</span>, <span style="color: maroon;">label</span>, <span style="color: maroon;">input</span>, <span style="color: maroon;">textarea</span>, <span style="color: maroon;">img</span>, <span style="color: maroon;">span</span>{</span>

<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>      </span><span style="color: red;">margin</span>:<span style="color: blue;">0</span>; <span style="color: red;">padding</span>:<span style="color: blue;">0</span>;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">}</span>

<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">ul</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">{</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>     </span><span style="color: red;">margin</span>:<span style="color: blue;">0</span>; </span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>     </span><span style="color: red;">padding</span>:<span style="color: blue;">0</span>; </span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>     </span><span style="color: red;">list-style-type</span>:<span style="color: blue;">none</span>;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>     </span><span style="color: red;">font-size</span>:<span style="color: blue;">12px</span>;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>     </span><span style="color: red;">line-height</span>:<span style="color: blue;">150%</span>;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">}</span>

<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">.spacer</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">{</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>      </span><span style="color: red;">clear</span>:<span style="color: blue;">both</span>; </span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>
      </span><span style="color: red;">font-size</span>:<span style="color: blue;">0</span>; </span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>      </span><span style="color: red;">line-height</span>:<span style="color: blue;">0</span>;</span>
}

<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: green;">/*-------------------body_area--------------------*/</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">#body_area</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">{</span>

<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>      </span><span style="color: red;">width</span>:<span style="color: blue;">1004px</span>;
</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>    </span><span>  </span><span style="color: red;">margin-top</span>:<span style="color: blue;">10px</span>;
</span><span>      </span><span style="color: red;">margin-right</span>:<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span style="color: blue;">auto</span>;</span><span>
       </span><span style="color: red;">margin-bottom</span>:<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span style="color: blue;">0</span>;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>      </span><span style="color: red;">margin-left</span>:<span style="color: blue;">auto</span>;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>      </span><span style="color: red;">font-family</span>:<span style="color: blue;">Tahoma</span>;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>      </span><span style="color: red;">font-size</span>: <span style="color: blue;">12px</span>;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>      </span><span style="color: red;">font-style</span>:<span style="color: blue;">normal</span>;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>      </span><span style="color: red;">line-height</span>:<span style="color: blue;">normal</span>;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>      </span><span style="color: red;">font-weight</span>:<span style="color: blue;">bold</span>;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>      </span><span style="color: red;">font-variant</span>:<span style="color: blue;">normal</span>;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>      </span><span style="color: red;">text-transform</span>:<span style="color: blue;">none</span>;</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>
</span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>      </span><span style="color: red;">text-decoration</span>:<span style="color: blue;">none</span>;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>      </span><span style="color: red;">padding</span>: <span style="color: blue;">0px</span>;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>      </span><span style="color: red;">float</span>: <span style="color: blue;">none</span>;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">}</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">#logo</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">{</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>  </span><span style="color: red;">width</span>:<span style="color: blue;">170px</span>;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>  </span><span style="color: red;">height</span>:<span style="color: blue;">100px</span>;</span>

<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">}</span>

<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">#left</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"> {</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>      </span><span style="color: red;">margin</span>: <span style="color: blue;">0px</span>;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>      </span><span style="color: red;">float</span>: <span style="color: blue;">left</span>;</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>  </span></span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>      </span><span style="color: red;">width</span>: <span style="color: blue;">185px</span>;</span>
       <span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span style="color: red;">height</span>: <span style="color: blue;">500px</span>;</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>
      </span><span style="color: red;">padding-top</span>:<span style="color: blue;">4px</span>;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>      </span><span style="color: red;">padding-right</span>:<span style="color: blue;">0px</span>;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>      </span><span style="color: red;">padding-bottom</span>:<span style="color: blue;">0px</span>;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>      </span><span style="color: red;">padding-left</span>:<span style="color: blue;">0px</span>;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>      </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span style="color: red;">background-color</span>:<span style="color: blue;">#EDE8D3</span>;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>      </span><span style="color: red;">margin-bottom</span>:<span style="color: blue;">12px</span>;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">}</span>

<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">#left</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"> <span style="color: maroon;">div.InnerText</span></span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">{</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>      </span><span style="color: red;">padding-left</span>:<span style="color: blue;">12px</span>;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">}</span>

<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">div.Nav</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">{</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>    </span><span style="color: red;">width</span>:<span style="color: blue;">140px</span>;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>    </span><span style="color: red;">margin-right</span>:<span style="color: blue;">auto</span>;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>    </span><span style="color: red;">margin-left</span>:<span style="color: blue;">auto</span>;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>    </span><span style="color: red;">background-color</span>:<span style="color: blue;">#E3DCBD</span>;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>    </span><span style="color: red;">padding-bottom</span>:<span style="color: blue;">20px</span>;</span>

<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">}</span>

<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">ul.Nav</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">{</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>      </span><span style="color: red;">padding</span>: <span style="color: blue;">8px</span> <span style="color: blue;">0px</span> <span style="color: blue;">0</span> <span style="color: blue;">22px</span>;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>      </span><span style="color: red;">background-color</span>:<span style="color: blue;">#E3DCBD</span>;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>      </span><span style="color: red;">color</span>:<span style="color: blue;">#000</span>;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>      </span><span style="color: red;">margin</span>:<span style="color: blue;">0</span> <span style="color: blue;">0</span> <span style="color: blue;">0</span> <span style="color: blue;">2px</span>;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">}</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>   </span></span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">ul.Nav</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"> <span style="color: maroon;">li</span></span>
{
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>   </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span style="color: red;">background</span>:<span style="color: blue;">url('images/nav_div2.gif')</span> <span style="color: blue;">repeat-x</span> <span style="color: blue;">left</span> <span style="color: blue;">bottom</span>;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>   </span><span style="color: red;">font-size</span>:<span style="color: blue;">0</span>;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>   </span><span style="color: red;">line-height</span>:<span style="color: blue;">0</span></span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">}</span>

<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">ul.Nav</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"> <span style="color: maroon;">li</span> <span style="color: maroon;">a</span></span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">{</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>      </span><span style="color: red;">display</span>:<span style="color: blue;">block</span>;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>      </span><span style="color: red;">background</span>:<span style="color: blue;">inherit</span> <span style="color: blue;">url('images/arrow.gif')</span><span style="color: blue;">no-repeat</span> <span style="color: blue;">2px</span> <span style="color: blue;">6px</span>;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>      </span><span style="color: red;">color</span>:<span style="color: blue;">#787159</span>;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>      </span><span style="color: red;">text-decoration</span>:<span style="color: blue;">none</span>;
      <span style="color: red;">font-weight</span>:<span style="color: blue;">bolder</span>; <span style="color: red;">font-style</span>:<span style="color: blue;">normal</span>; <span style="color: red;">font-variant</span>:<span style="color: blue;">normal</span>;
      <span style="color: red;">line-height</span>:<span style="color: blue;">17px</span>; <span style="color: red;">
      font-size</span>:<span style="color: blue;">11px</span>; <span style="color: red;">font-family</span>:<span style="color: blue;">Arial,</span> <span style="color: blue;">Helvetica,</span> <span style="color: blue;">sans-serif</span>;
      <span style="color: red;">padding-left</span>:<span style="color: blue;">8px</span>; <span style="color: red;">padding-right</span>:<span style="color: blue;">0</span>; <span style="color: red;">padding-top</span>:<span style="color: blue;">0</span>; <span style="color: red;">padding-bottom</span>:<span style="color: blue;">0</span>;
      <span style="color: red;">background-color</span>:<span style="color: blue;">inherit</span></span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">}</span>

<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">ul.Nav</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"> <span style="color: maroon;">li</span> <span style="color: maroon;">a:hover</span>{</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>      </span><span style="color: red;">color</span>:<span style="color: blue;">#A73F00</span>;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>      </span><span style="color: red;">background-color</span>:<span style="color: blue;">#EFECC8</span>;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">}</span>

<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">#banner</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">{</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>      </span><span style="color: red;">width</span>:<span style="color: blue;">620px</span>;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>      </span><span style="color: red;">height</span>:<span style="color: blue;">100px</span>;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>      </span><span style="color: red;">margin-left</span>:<span style="color: blue;">auto</span>;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>      </span><span style="color: red;">margin-right</span>:<span style="color: blue;">auto</span>;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>      </span><span style="color: red;">text-align</span>:<span style="color: blue;">center</span> ;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>      </span><span style="color: red;">background-color</span>:<span style="color: blue;">Gray</span> ;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">}</span>

<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">#mid</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"> {</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>      </span><span style="color: red;">margin</span>: <span style="color: blue;">0px</span>;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>      </span><span style="color: red;">padding</span>: <span style="color: blue;">0px</span>;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>      </span><span style="color: red;">float</span>: <span style="color: blue;">left</span>;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>      </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span style="color: red;">width</span>: <span style="color: blue;">628px</span>;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>      </span><span style="color: red;">color</span>:<span style="color: blue;">black</span>;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>      </span><span style="color: red;">line-height</span>:<span style="color: blue;">150%</span>;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>      </span><span style="color: red;">font-weight</span>:<span style="color: blue;">normal</span> ;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>      </span><span style="color: red;">font-size</span>:<span style="color: blue;">12px</span>;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>      </span><span style="color: red;">background-color</span>:<span style="color: blue;">#E3DCBD</span>;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>     </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span> </span><span style="color: red;">padding-bottom</span>:<span style="color: blue;">20px</span>;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>      </span><span style="color: red;">margin-bottom</span>:<span style="color: blue;">12px</span>;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">}</span>

<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">#mid</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"> <span style="color: maroon;">div.InnerText</span></span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">{</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>      </span><span style="color: red;">margin-left</span>:<span style="color: blue;">12px</span>;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>      </span><span style="color: red;">margin-right</span>:<span style="color: blue;">12px</span>;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>      </span><span style="color: red;">margin-top</span>:<span style="color: blue;">20px</span>;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>      </span><span style="color: red;">padding</span>:<span style="color: blue;">0</span>;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>      </span><span style="color: red;">color</span>:<span style="color: blue;">black</span>;</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>     </span></span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">}</span>

<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">#mid</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"> <span style="color: maroon;">a</span></span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">{</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>      </span><span style="color: red;">color</span>:<span style="color: blue;">#A73F00</span>;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>      </span><span style="color: red;">text-decoration</span>:<span style="color: blue;">none</span>;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>      </span><span style="color: red;">font-weight</span>:<span style="color: blue;">bolder</span> ;</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>    </span></span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">}</span>

<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">#right</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">{</span>

<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>      </span><span style="color: red;">margin</span>: <span style="color: blue;">0px</span>;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>      </span><span style="color: red;">float</span>: <span style="color: blue;">right</span>;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>      </span><span style="color: red;">width</span>: <span style="color: blue;">185px</span>;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>      </span><span style="color: red;">padding-top</span>:<span style="color: blue;">2px</span>;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>      </span><span style="color: red;">padding-right</span>:<span style="color: blue;">0px</span>;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>      </span><span style="color: red;">padding-bottom</span>:<span style="color: blue;">0px</span>;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>      </span><span style="color: red;">padding-left</span>:<span style="color: blue;">0px</span>;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>  </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>    </span><span style="color: red;">margin-bottom</span>:<span style="color: blue;">12px</span>;</span>
<span style="font-family: &quot;Courier New&quot;;">}</span>

<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">#right</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"> <span style="color: maroon;">div.InnerText</span></span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">{</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>            </span><span style="color: red;">padding-left</span>:<span style="color: blue;">10px</span>;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">}</span>

<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: green;">/*-----------------------fotter--------------------*/</span>

<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">#footer</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">{</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>  </span><span style="color: red;">clear</span>:<span style="color: blue;">both</span>;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>  </span><span style="color: red;">border</span>:<span style="color: blue;">solid</span> <span style="color: blue;">1px</span> <span style="color: blue;">black</span>;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">}</span>

<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">#footer</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"> <span style="color: maroon;">div.InnerText</span></span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">{</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>        </span><span style="color: red;">padding</span>:<span style="color: blue;">10px</span>;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">}</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">
</span></pre>
<p><a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fwww.tutorialsasp.net%2ftutorials%2fbuild-a-3-column-layout-using-css-master-pages-and-themes%2f"><img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fwww.tutorialsasp.net%2ftutorials%2fbuild-a-3-column-layout-using-css-master-pages-and-themes%2f" border="0" alt="kick it on DotNetKicks.com" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.tutorialsasp.net/tutorials/build-a-3-column-layout-using-css-master-pages-and-themes/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>How to encrypt a query string ?</title>
		<link>http://www.tutorialsasp.net/tutorials/how-to-encrypt-a-query-string/</link>
		<comments>http://www.tutorialsasp.net/tutorials/how-to-encrypt-a-query-string/#comments</comments>
		<pubDate>Fri, 05 Dec 2008 07:40:14 +0000</pubDate>
		<dc:creator>Vihutuo</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[encrypt]]></category>
		<category><![CDATA[query string]]></category>
		<category><![CDATA[TSHAK]]></category>

		<guid isPermaLink="false">http://www.tutorialsasp.net/?p=251</guid>
		<description><![CDATA[Few months back I had used a nice component from TSHAK to encrypt query strings. it requires just one line of code to encrypt a query string. Right now I am unable to find the exact page at TSHAK where I got the control. Due to a site re organization at TSHAK , they might [...]]]></description>
			<content:encoded><![CDATA[<p>Few months back I had used a nice component from <a href="http://tshak.net/cs/blogs/tshak/default.aspx" target="_blank">TSHAK</a> to encrypt query strings. it requires just one line of code to encrypt a query string. Right now I am unable to find the exact page at TSHAK where I got the control. Due to a site re organization at TSHAK , they might have moved it to some other place. You can download the component <a href="http://www.tutorialsasp.net/TSHAK.Components.dll">here</a> and place it in your bin folder.</p>
<p>To encrypt a query string we will need to pass it an encryption key which is a byte array<br />
<code><br />
Dim qs As TSHAK.Components.SecureQueryString<br />
qs = New TSHAK.Components.SecureQueryString(New Byte() {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 8})<br />
</code><br />
To add the query string values<br />
<code>qs("Myname")="John"<br />
qs("MyAge")=5<br />
Response.Redirect("Page2.aspx?data=" + HttpUtility.UrlEncode(qs.ToString()))<br />
</code></p>
<p>Now to decrypt and use the values in Page2.aspx<br />
<code>Dim qs As TSHAK.Components.SecureQueryString<br />
qs= New TSHAK.Components.SecureQueryString(New Byte() {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 8}, Request("data"))<br />
Dim myName=qs("MyName")<br />
Dim age=qs("MyAge")<br />
</code></p>
<p><a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fwww.tutorialsasp.net%2ftutorials%2fhow-to-encrypt-a-query-string%2f"><img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fwww.tutorialsasp.net%2ftutorials%2fhow-to-encrypt-a-query-string%2f" border="0" alt="kick it on DotNetKicks.com" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.tutorialsasp.net/tutorials/how-to-encrypt-a-query-string/feed/</wfw:commentRss>
		<slash:comments>22</slash:comments>
		</item>
		<item>
		<title>Loading and previewing fonts from files in ASP.NET</title>
		<link>http://www.tutorialsasp.net/uncategorized/loading-and-previewing-fonts-from-files-in-aspnet/</link>
		<comments>http://www.tutorialsasp.net/uncategorized/loading-and-previewing-fonts-from-files-in-aspnet/#comments</comments>
		<pubDate>Sat, 11 Oct 2008 08:10:44 +0000</pubDate>
		<dc:creator>Vihutuo</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Fonts from file]]></category>
		<category><![CDATA[PrivateFontCollectionClass]]></category>

		<guid isPermaLink="false">http://www.tutorialsasp.net/?p=130</guid>
		<description><![CDATA[Few weeks back I created a free fonts preview and download site www.freedownloadablefonts.net. There are around 6000 fonts in .ttf files and I needed to display a preview of the fonts. All the fonts were copied to a folder &#8220;~/Fonts&#8221;. Then I created a http handler &#8220;GetFontImage.ashx&#8221; to which the font path and text to [...]]]></description>
			<content:encoded><![CDATA[<p>Few weeks back I created a free fonts preview and  download site <a title="Free downloadable fonts" href="http://www.freedownloadablefonts.net" target="_blank">www.freedownloadablefonts.net</a>. There are around 6000 fonts in .ttf files and I needed to display a preview of the fonts. All the fonts were copied to a folder &#8220;~/Fonts&#8221;. Then I created a http handler &#8220;GetFontImage.ashx&#8221; to which the font path and text to display was passed as query strings . It created an image using the font specified. The code for &#8220;<strong>GetFontImage.ashx</strong>&#8221; is as follows</p>
<p><code>&lt;%@ WebHandler Language="VB" Class="GetFontImage" %&gt;<br />
Imports System<br />
Imports System.Web<br />
Public Class GetFontImage : Implements IHttpHandler<br />
Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest<br />
context.Response.ContentType = "image/png"<br />
Dim fontpath As String = context.Request.QueryString("fontpath")<br />
Dim Text As String = context.Request.QueryString("Text")<br />
Dim FontImage As System.Drawing.Bitmap = clsUtility.GetFontPic(fontpath, Text)<br />
Dim ms As IO.MemoryStream = New IO.MemoryStream()<br />
FontImage.Save(ms, System.Drawing.Imaging.ImageFormat.Png)<br />
Dim FontImageBytes() As Byte = ms.GetBuffer()<br />
FontImage.Dispose()<br />
ms.Close()<br />
context.Response.BinaryWrite(FontImageBytes)<br />
context.Response.End()<br />
End Sub<br />
End Class<br />
</code><br />
GetFontImage.ashx calls another function clsUtility.GetFontPic(fontpath, Text) whose code is as follows. clsUtility.GetFontPic(fontpath, Text) uses the privatefontcollection class to load the font from file<br />
<code><br />
Imports Microsoft.VisualBasic<br />
Imports System.IO<br />
Imports System.Drawing<br />
Imports System.Drawing.Text<br />
Imports System.Drawing.Imaging<br />
Imports System.Drawing.Drawing2D<br />
Public Class clsUtility<br />
Public Shared Function GetFontPic(ByVal Fontpath As String, ByVal Text As String) As System.Drawing.Bitmap<br />
Dim width As Integer = 620<br />
Dim height As Integer = 30<br />
Dim FontImage As New System.Drawing.Bitmap(width, height, PixelFormat.Format24bppRgb)<br />
Dim g As Graphics = Graphics.FromImage(FontImage)<br />
g.Clear(Color.White)<br />
g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias<br />
g.SmoothingMode = SmoothingMode.AntiAlias<br />
Dim pointF As New PointF(10,0)<br />
Dim FontSize As Integer = 24<br />
Dim solidBrush As New SolidBrush(Color.Black)<br />
Dim privateFontCollection As New PrivateFontCollection()<br />
privateFontCollection.AddFontFile(Fontpath)   ' load font from file<br />
Dim thisFont As FontFamily = privateFontCollection.Families(0)<br />
Dim regFont As New Font(thisFont, FontSize, FontStyle.Regular, GraphicsUnit.Pixel) ' Create a new font<br />
g.DrawString(Text, regFont, solidBrush, pointF) ' Using the font write the text using the font style<br />
Return FontImage<br />
End Function<br />
</code><br />
All the font information were stored in a database in a table with the following columns<br />
1. FontID<br />
2. FontName<br />
3. Path<br />
4. AddedDate<br />
A script can be easily created to add all the font information to the table using the privatefontcolection class as above<br />
The home page displays the 10 latest fonts in a gridview. The code is as folows<br />
<strong> Default.aspx</strong><br />
<code><br />
&lt;asp:GridView ID="GridView1" runat="server" AllowPaging="True" AutoGenerateColumns="False" DataKeyNames="FontID" DataSourceID="SqlDataSourceFonts" ShowHeader="False" Width="100%" GridLines="None" BorderStyle=None BorderWidth="0"&gt;<br />
&lt;Columns&gt;<br />
&lt;asp:TemplateField ItemStyle-BackColor="White" HeaderText="Image" ItemStyle-BorderWidth="0"&gt;                 &lt;ItemTemplate&gt;<br />
&lt;asp:Image AlternateText='&lt;%# Eval("FontName") %&gt;'  ImageUrl='&lt;%# GetImageURL(Eval("path"),Eval("FontName")) %&gt; ' ID="FontImage" runat="server" /&gt;<br />
&lt;/ItemTemplate&gt;<br />
&lt;/asp:TemplateField&gt;<br />
&lt;/Columns&gt;<br />
&lt;/asp:GridView&gt;<br />
&lt;asp:SqlDataSource ID="SqlDataSourceFonts" runat="server" ConnectionString="&lt;%$ ConnectionStrings:FontsConnectionString %&gt;"<br />
SelectCommand="SELECT TOP 10 * FROM [Fonts_Fonts] ORDER BY [AddedDate] DESC"&gt;<br />
</code><br />
The code is pretty straight forward with a Gridview bound to an SQLDatasource. The code for GetImageURL() is as follows<br />
<strong> Default.aspx.vb</strong><br />
<code><br />
Public Function GetImageURL(ByVal Path As String, ByVal FontName As String)<br />
Return "GetFontImage.ashx?FontPath=" &amp; Server.MapPath(Path) &amp; "&amp;Text=" &amp; FontName<br />
End Function<br />
</code><br />
<a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fwww.tutorialsasp.net%2funcategorized%2floading-and-previewing-fonts-from-files-in-aspnet%2f"><img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fwww.tutorialsasp.net%2funcategorized%2floading-and-previewing-fonts-from-files-in-aspnet%2f" border="0" alt="kick it on DotNetKicks.com" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.tutorialsasp.net/uncategorized/loading-and-previewing-fonts-from-files-in-aspnet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fixing postbacks while using URLRewriter.net</title>
		<link>http://www.tutorialsasp.net/tutorials/fixing-postbacks-while-using-urlrewriternet/</link>
		<comments>http://www.tutorialsasp.net/tutorials/fixing-postbacks-while-using-urlrewriternet/#comments</comments>
		<pubDate>Wed, 01 Oct 2008 13:10:10 +0000</pubDate>
		<dc:creator>Vihutuo</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[postback error]]></category>
		<category><![CDATA[URLRewriter.NET]]></category>
		<category><![CDATA[URLrewriter.net postback fix]]></category>

		<guid isPermaLink="false">http://www.tutorialsasp.net/?p=111</guid>
		<description><![CDATA[Last week I had done a post on how to rewrite URLs using the URLRewriter.Net component. You can read it here . Another issue that comes up while using URL rewriting in ASP.NET is the problem of postbacks. Whenever a postback occurs in the page, you find that after the postback the URL in the [...]]]></description>
			<content:encoded><![CDATA[<p>Last week I had done a post on how to rewrite URLs using the URLRewriter.Net component. You can read it <a title="URL rewriting" href="http://www.tutorialsasp.net/tutorials/url-rewriting-in-aspnet-using-urlrewriternet/">here</a> . Another issue that comes up while using URL rewriting in ASP.NET is the problem of postbacks. Whenever a postback occurs in the page, you find that after the postback the URL in the address bar of the browser shows your ugly URL again which you were trying so hard to hide . You can test it out here in my website <a href="http://www.Christian-Jokes.net">Christian-Jokes.net</a> (I&#8217;ll be fixing it soon though ).  Go to any joke and check the URL in your browser . You will see the friendly URL. Now write down a short comment for the joke and submit the comment. After the comment is submitted, you see that the URL in the browser has changed to something like this &#8220;ShowJoke.aspx?JokeID=123&#8243; .</p>
<p>Thankfully, again the the guys at <a title="URLrewriter.Net" href="http://www.URLRewriter.net" target="_blank">URLrewriter.Net</a> has a simple solution for us, though it took me some time to find it . Add the following code at the top of your page<br />
<code><br />
&lt;%@ Register TagPrefix="url" Namespace="Intelligencia.UrlRewriter"<br />
Assembly="Intelligencia.UrlRewriter" %&gt;</code><br />
and then change your form tag from <span class="fixed_width" style="font-family: Courier,Monospaced;">&lt;asp:form runat=&#8221;server&#8221;&gt; to </span><span class="fixed_width" style="font-family: Courier,Monospaced;">&lt;url:form runat=&#8221;server&#8221;&gt;</span></p>
<p>If you are using master pages, you will most probably add the above lines in your master page file</p>
<p>Check your webpage and postbacks and URL rewriting should be working fine now !<br />
<a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fwww.tutorialsasp.net%2ftutorials%2ffixing-postbacks-while-using-urlrewriternet%2f"><img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fwww.tutorialsasp.net%2ftutorials%2ffixing-postbacks-while-using-urlrewriternet%2f" border="0" alt="kick it on DotNetKicks.com" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.tutorialsasp.net/tutorials/fixing-postbacks-while-using-urlrewriternet/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Caching a dataset for improving performance in ASP.NET</title>
		<link>http://www.tutorialsasp.net/tutorials/caching-a-dataset-for-improving-performance-in-aspnet/</link>
		<comments>http://www.tutorialsasp.net/tutorials/caching-a-dataset-for-improving-performance-in-aspnet/#comments</comments>
		<pubDate>Sat, 20 Sep 2008 13:24:43 +0000</pubDate>
		<dc:creator>Vihutuo</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[cache]]></category>
		<category><![CDATA[cache dataset]]></category>

		<guid isPermaLink="false">http://www.tutorialsasp.net/?p=76</guid>
		<description><![CDATA[In a website that I recently completed www.Christian-Jokes.net the left navigation bar listed the categories of jokes from the database. So on every page load I was querying the database to load the categories. Obviously this was a bad idea. I needed to cache the categories in memory without querying the database on every page [...]]]></description>
			<content:encoded><![CDATA[<p>In a website that I recently completed <a title="Christian Jokes" href="http://www.Christian-Jokes.net">www.Christian-Jokes.net</a> the left navigation bar listed the categories of jokes from the database. So on every page load I was querying the database to load the categories. Obviously this was a bad idea. I needed to cache the categories in memory without querying the database on every page load.   The categories were placed in the master page. In the master page page load event I wrote the following code to cache the categories of jokes</p>
<p><code>Dim JokeCategories As Data.DataSet<br />
JokeCategories = Cache("JokeCategories")<br />
If JokeCategories Is Nothing Then<br />
JokeCategories = GetJokeCategories()'This fn returns the categories<br />
Cache.Insert("JokeCategories", JokeCategories, Nothing, DateAdd(DateInterval.Minute, 180, Now()), Web.Caching.Cache.NoSlidingExpiration)<br />
End If<br />
RepeaterJokecategories.datasource=Jokecategories            RepeaterJokeCategories.Databind()</code></p>
<p>Just 5 lines of code and a great boost in performance !</p>
<p>Now the categories are loaded from the database only if they are not present in the cache. Once loaded the categories are placed in the cache for 180 minutes</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tutorialsasp.net/tutorials/caching-a-dataset-for-improving-performance-in-aspnet/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>URL Rewriting in ASP.NET using URLRewriter.Net</title>
		<link>http://www.tutorialsasp.net/tutorials/url-rewriting-in-aspnet-using-urlrewriternet/</link>
		<comments>http://www.tutorialsasp.net/tutorials/url-rewriting-in-aspnet-using-urlrewriternet/#comments</comments>
		<pubDate>Fri, 05 Sep 2008 05:23:21 +0000</pubDate>
		<dc:creator>Vihutuo</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Friendly URLs]]></category>
		<category><![CDATA[URL Rewriting]]></category>
		<category><![CDATA[URLRewriter.NET]]></category>

		<guid isPermaLink="false">http://tutorialsasp.net/?p=63</guid>
		<description><![CDATA[Friendly URLs have become necessary to obtain better rankings in Search engines. The improvement in rankings may not be huge but because of the burgeoning of websites in almost every niche we need to use every single advantage that we can get. Friendly URLs are URLS without a query sting or without the &#8220;?&#8221; character. [...]]]></description>
			<content:encoded><![CDATA[<p>Friendly URLs have become necessary to obtain better rankings in Search engines. The improvement in rankings may not be huge but because of the burgeoning of websites in almost every niche we need to use every single advantage that we can get. Friendly URLs are URLS without a query sting or without the &#8220;?&#8221; character. Friendly URLs have a URL structure which look like static pages instead of dynamic pages.</p>
<p>Unfriendly URL : &#8220;www.MyShop.com/ShowProduct.aspx?ProductID=1<br />
Friendly URL : &#8220;www.MyShop.com/Monitors/Samsung-Syncmaster.aspx</p>
<p>The absence of a good, built in URL rewriting solution in ASP.NET makes it difficut to implement friendly URLs in dynamic pages. The only type of URL rewriting available in ASP.NET can be used only for small websites with a few pages since we need to have a rule for each page. The following is an example of URL rewriting which can  be done in the web.config file<br />
<code><br />
&lt;system.web&gt;<br />
&lt;urlMappings enabled="true"&gt;<br />
&lt;add<br />
url="~/Clubs/Computer Club.aspx"<br />
mappedUrl="~/ShowPage.aspx?PageID=1" /&gt;<br />
&lt;add<br />
url="~/Clubs/Eco Club.aspx"<br />
mappedUrl="~/ShowPage.aspx?PageID=2" /&gt;<br />
&lt;/urlMappings &gt;<br />
&lt;/system.web&gt;<br />
</code><br />
You can easily see that a website with even a fairly large number of pages can become difficult to maintain.  Adding or deleting of pages will also require the web.cong file to be modified. This is a tedious solution and certainly not suitable for medium to large dynamic sites.</p>
<p>The guys at <a rel="nofollow" href="http://urlrewriter.net/">URLRewriter.NET</a> have made a very useful URL Rewriting component . The best thing about it is that it is very simple to implement  and it works in a shared hosting environment. All you have to do is <a rel="nofollow" href="http://urlrewriter.net/index.php/download">download</a> the dll file and copy it to your bin directory. Add a few lines in your web.config file as follows.</p>
<p><code><br />
&lt;configSections&gt;<br />
&lt;section name="rewriter"<br />
requirePermission="false"<br />
type="Intelligencia.UrlRewriter.Configuration.RewriterConfigurationSectionHandler, Intelligencia.UrlRewriter" /&gt;<br />
&lt;/configSections&gt;<br />
&lt;system.web&gt;<br />
&lt;httpModules&gt;<br />
&lt;add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule, Intelligencia.UrlRewriter"/&gt;<br />
&lt;/httpModules&gt;<br />
&lt;/system.web&gt;<br />
</code><br />
Now you will have to define the rules in your web.config file</p>
<p>An example of a rule is as follows<br />
<code><br />
&lt;rewriter&gt;<br />
&lt;rewrite url = "~/Products/([^/.]+)\.aspx" to="~/ListProducts.aspx?Category=$1" /&gt;<br />
&lt;rewrite url = "~/Products/(.+)/([0-9]+)-(.+).aspx" to="~/ShowProduct.aspx?ProductName=$2&amp;ProductID=$1" /&gt;<br />
&lt;/rewriter&gt;<br />
</code><br />
According to the the first rule  &#8220;<strong>~/Products/Monitors.aspx</strong>&#8221; will be rewritten as  &#8220;<strong>~/ListProducts.aspx?Category=Monitors</strong>&#8221;<br />
According to the second rule &#8220;<strong>~/Products/Monitors/3-Samsung940BW.aspx</strong>&#8221; will be rewritten as  &#8220;<strong>~/ShowProduct.aspx?ProductName=Samsung940BW&amp;ProductID=3</strong>&#8221;</p>
<p>Thus now you can use the friendly URLS instead of the URLs with query strings. It&#8217;s simple as that !</p>
<p>After using URLRewrite.NET , I had noticed a major bug. The bug is not in the component but with ASP.NET URL rewriting itself. All the pages using URL Rewriting <strong>do not get indexed by Google, </strong>this happens for both the built in URL rewriting and URLRewriter.NET component. Google bots cannot crawl pages which use Rewriting. It gives an error &#8220;Network unreachable&#8221; . This is a major problem for websites which depend on search engine traffic and almost all websites do.</p>
<p>After searching around a lot , I found a solution . The solution is to create a file name &#8220;genericmozilla5.browser&#8221; under the &#8220;App_Browsers&#8221; Directory in your root directory. Type in the following in the file<br />
<code><br />
&lt;browsers&gt;<br />
&lt;browser id="GenericMozilla5" parentID="Mozilla"&gt;<br />
&lt;identification&gt;<br />
&lt;userAgent match="Mozilla/5\.(?'minor'\d+).*[C|c]ompatible; ?(?'browser'.+); ?\+?(http://.+)\)" /&gt;<br />
&lt;/identification&gt;<br />
&lt;capabilities&gt;<br />
&lt;capability name="majorversion" value="5" /&gt;<br />
&lt;capability name="minorversion" value="${minor}" /&gt;<br />
&lt;capability name="browser" value="${browser}" /&gt;<br />
&lt;capability name="Version" value="5.${minor}" /&gt;<br />
&lt;capability name="activexcontrols" value="true" /&gt;<br />
&lt;capability name="backgroundsounds" value="true" /&gt;<br />
&lt;capability name="cookies" value="true" /&gt;<br />
&lt;capability name="css1" value="true" /&gt;<br />
&lt;capability name="css2" value="true" /&gt;<br />
&lt;capability name="ecmascriptversion" value="1.2" /&gt;<br />
&lt;capability name="frames" value="true" /&gt;<br />
&lt;capability name="javaapplets" value="true" /&gt;<br />
&lt;capability name="javascript" value="true" /&gt;<br />
&lt;capability name="jscriptversion" value="5.0" /&gt;<br />
&lt;capability name="supportsCallback" value="true" /&gt;<br />
&lt;capability name="supportsFileUpload" value="true" /&gt;<br />
&lt;capability name="supportsMultilineTextBoxDisplay" value="true" /&gt;<br />
&lt;capability name="supportsMaintainScrollPositionOnPostback" value="true" /&gt;<br />
&lt;capability name="supportsVCard" value="true" /&gt;<br />
&lt;capability name="supportsXmlHttp" value="true" /&gt;<br />
&lt;capability name="tables" value="true" /&gt;<br />
&lt;capability name="vbscript" value="true" /&gt;<br />
&lt;capability name="w3cdomversion" value="1.0" /&gt;<br />
&lt;capability name="xml" value="true" /&gt;<br />
&lt;capability name="tagwriter" value="System.Web.UI.HtmlTextWriter" /&gt;<br />
&lt;/capabilities&gt;<br />
&lt;/browser&gt;<br />
&lt;/browsers&gt;</code></p>
<p>This solved the problem for me.</p>
<p><strong>Update :</strong><br />
Also check my post on <a title="Fixing-postbacks-while-using-urlrewriternet" href="http://www.tutorialsasp.net/tutorials/fixing-postbacks-while-using-urlrewriternet/" target="_self">fixing postbacks while using URLRewriter.net</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.tutorialsasp.net/tutorials/url-rewriting-in-aspnet-using-urlrewriternet/feed/</wfw:commentRss>
		<slash:comments>55</slash:comments>
		</item>
		<item>
		<title>Basic SEO tips</title>
		<link>http://www.tutorialsasp.net/tutorials/basic-seo-tips/</link>
		<comments>http://www.tutorialsasp.net/tutorials/basic-seo-tips/#comments</comments>
		<pubDate>Mon, 25 Aug 2008 19:22:18 +0000</pubDate>
		<dc:creator>Vihutuo</dc:creator>
				<category><![CDATA[SEO]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[META tags]]></category>
		<category><![CDATA[title]]></category>

		<guid isPermaLink="false">http://tutorialsasp.net/?p=14</guid>
		<description><![CDATA[Here are a few basic tips for on page search engine optimisation that i try to implement in all my websites. 1. The page title gets top priority. It should be short. Only your main keywords should be in the title. Eliminated all unwanted words. Replace the word “and” with &#124; so that you can [...]]]></description>
			<content:encoded><![CDATA[<p>Here are a few basic tips for on page <strong>search engine optimisation</strong> that i try to implement in all my websites.</p>
<p>1. <strong>The page title gets top priority</strong>. It should be short. Only your main keywords should be in the title. Eliminated all unwanted words. Replace the word “and” with | so that you can save some characters. For example ” Read funny jokes here ” can be replaced with just “Funny jokes”. Stuffing too many keywords in the title can be counter productive. Keep only your main keywords there.</p>
<p>2. After the title , in the page content , the first line should be the <strong>heading of the page</strong> enclosed in<br />
&lt;h1&gt; tags. Be sure to put one keyword in your heading too. Next you can have a sub heading&lt;h1&gt;<br />
&lt;h2&gt; where you can place another keyword. In the content of the page you can bold and italicize some of the keywords that you are aiming for. Do not overdo it however.</p>
<p>3. Have an <strong>alt attribute for all your image</strong> tags. You can put another keyword in the alt attribute of the image too. Again keep the alt text short.</p>
<p>4. At last in the <strong>footer of your page</strong>, end it with another keyword !<br />
Copyright © Funny Jokes everyday.</p>
<p>5. <strong>Use Meta tags</strong> . the META description is important as the META description appears just below the link to your website when someone does a Google search. If you do not include a META description Google selects some text frm your content and displays it which most of the time is not satisfactory .  People are going to read the description and decide whether to click the link to your website or not. So make sure your description contains useful info which will encourage the users to click on your link. The length of the META description should be around 120 -180 characters.</p>
<p><script type="text/javascript"><!--
google_ad_client = "pub-6894514748672358";
/* 468x60, created 9/26/08 Tutorials ASP */
google_ad_slot = "3921198892";
google_ad_width = 468;
google_ad_height = 60;
// --></script><br />
<script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.tutorialsasp.net/tutorials/basic-seo-tips/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using MySQL in ASP.NET</title>
		<link>http://www.tutorialsasp.net/tutorials/using-mysql-is-aspnet/</link>
		<comments>http://www.tutorialsasp.net/tutorials/using-mysql-is-aspnet/#comments</comments>
		<pubDate>Mon, 25 Aug 2008 18:57:08 +0000</pubDate>
		<dc:creator>Vihutuo</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[MySQL Connection String]]></category>
		<category><![CDATA[MySQL membership provider]]></category>

		<guid isPermaLink="false">http://tutorialsasp.net/?p=9</guid>
		<description><![CDATA[Most web hosts provide more mySQL databases than SQl Server 2005 database. To keep your hosting costs low , you might need to use MySQL in your projects. To connect to MySQL database First download the drivers here Then copy MySql.Data .dll and MySql.Web.dll to your bin directory The connection string is as follows &#60;add [...]]]></description>
			<content:encoded><![CDATA[<p>Most web hosts provide more mySQL databases than SQl Server 2005 database. To keep your hosting costs low , you might need to use MySQL in your projects.</p>
<p>To connect to MySQL database<br />
First download the drivers <a href="http://dev.mysql.com/downloads/connector/net/5.2.html" rel="nofollow">here</a><br />
Then copy  MySql.Data .dll and MySql.Web.dll to your bin directory</p>
<p>The connection string is as follows<br />
<code><br />
&lt;add name="ASPNETDBConnectionString" connectionString = "Server=localhost;User ID=youruserID; Password=yourpassword; Database=databasename"<br />
   providerName="MySql.Data.MySqlClient" /&gt;<br />
</code></p>
<p>The MySQl Connector 5.2 has built in support for membership provider too. So from inside Visual Studio you can use the ASP.NET configuration to automatically generate the membership schema</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tutorialsasp.net/tutorials/using-mysql-is-aspnet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

