<?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/"
	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>ASP.Net 101</title>
	<atom:link href="http://bjornwilliams.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://bjornwilliams.wordpress.com</link>
	<description>A collection of Interesting Articles about ASP.net</description>
	<lastBuildDate>Mon, 13 Jul 2009 03:42:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='bjornwilliams.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>ASP.Net 101</title>
		<link>http://bjornwilliams.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://bjornwilliams.wordpress.com/osd.xml" title="ASP.Net 101" />
	<atom:link rel='hub' href='http://bjornwilliams.wordpress.com/?pushpress=hub'/>
		<item>
		<title>How To Implement Custom Rounding Procedures</title>
		<link>http://bjornwilliams.wordpress.com/2009/07/13/how-to-implement-custom-rounding-procedures/</link>
		<comments>http://bjornwilliams.wordpress.com/2009/07/13/how-to-implement-custom-rounding-procedures/#comments</comments>
		<pubDate>Mon, 13 Jul 2009 03:42:47 +0000</pubDate>
		<dc:creator>bjornwilliams</dc:creator>
				<category><![CDATA[Decimal Rounding Up]]></category>

		<guid isPermaLink="false">http://bjornwilliams.wordpress.com/?p=26</guid>
		<description><![CDATA[There are a number of different rounding algorithms available in Microsoft products. Rounding algorithms range from Arithmetic Rounding in Excel&#8217;s Worksheet Round() function to Banker&#8217;s Rounding in the CInt(), CLng(), and Round() functions in Visual Basic for Applications. The Round() function is not implemented in a consistent fashion among different Microsoft products for historical reasons.   [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=bjornwilliams.wordpress.com&amp;blog=2314322&amp;post=26&amp;subd=bjornwilliams&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>There are a number of different rounding algorithms available in Microsoft products. Rounding algorithms range from Arithmetic Rounding in Excel&#8217;s Worksheet Round() function to Banker&#8217;s Rounding in the CInt(), CLng(), and Round() functions in Visual Basic for Applications.</p>
<p>The Round() function is not implemented in a consistent fashion among different Microsoft products for historical reasons.  </p>
<p>I had an issue where in my .net code the number would be round down and in sql server the number would be round up. so I set out to write my own algorithm.</p>
<p>Friend Function Round(ByVal val As Decimal, ByVal Count As Integer) As Decimal<br />
        Dim retVal As Decimal = 0.0<br />
        Dim value As String = val<br />
        If Not String.IsNullOrEmpty(value) Then<br />
            Dim lenghtOfString As Integer = value.Length<br />
            Dim IndexOfPoint As Integer = value.IndexOf(&#8220;.&#8221;)<br />
            If IndexOfPoint &gt; 0 Then<br />
                Dim ValueBeforePoint As String = value.Substring(0, IndexOfPoint)<br />
                Dim ValueAfterPoint As String = value.Remove(0, IndexOfPoint + 1)<br />
                Dim LenghtOfAfterPoint As Integer = ValueAfterPoint.Length &#8211; 1<br />
                Dim newValue As Integer<br />
                If LenghtOfAfterPoint + 1 &lt;= Count Then<br />
                    retVal = ValueBeforePoint &amp; &#8220;.&#8221; &amp; ValueAfterPoint<br />
                Else<br />
                    For i As Integer = LenghtOfAfterPoint To 0 Step -1<br />
                        Dim strchar As String = ValueAfterPoint(i)<br />
                        If strchar &gt;= &#8220;5&#8243; Then<br />
                            &#8216;Increase next value<br />
                            Dim NextValue As String = ValueAfterPoint(i &#8211; 1)<br />
                            newValue = CInt(NextValue) + 1<br />
                            Dim indexOfNextVal As Integer = ValueAfterPoint.LastIndexOf(NextValue)<br />
                            If indexOfNextVal = ValueAfterPoint.Length &#8211; 1 Then<br />
                                indexOfNextVal = indexOfNextVal &#8211; 1<br />
                            End If<br />
                            ValueAfterPoint = ValueAfterPoint.Remove(indexOfNextVal, 2)<br />
                            ValueAfterPoint = ValueAfterPoint.Insert(indexOfNextVal, newValue)<br />
                        Else<br />
                            &#8216;decrease next values<br />
                            Dim NextValue As String = ValueAfterPoint(i &#8211; 1)<br />
                            newValue = CInt(NextValue)<br />
                            Dim indexOfNextVal As Integer = ValueAfterPoint.LastIndexOf(NextValue)<br />
                            If indexOfNextVal = ValueAfterPoint.Length &#8211; 1 Then<br />
                                indexOfNextVal = indexOfNextVal &#8211; 1<br />
                            End If<br />
                            ValueAfterPoint = ValueAfterPoint.Remove(indexOfNextVal, 2)<br />
                            ValueAfterPoint = ValueAfterPoint.Insert(indexOfNextVal, newValue)<br />
                        End If<br />
                        If ValueAfterPoint.Length = Count Then<br />
                            retVal = ValueBeforePoint &amp; &#8220;.&#8221; &amp; ValueAfterPoint<br />
                            Exit For<br />
                        End If<br />
                    Next<br />
                End If<br />
            Else<br />
                retVal = val<br />
            End If<br />
        End If<br />
        Return retVal<br />
    End Function</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/bjornwilliams.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/bjornwilliams.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/bjornwilliams.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/bjornwilliams.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/bjornwilliams.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/bjornwilliams.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/bjornwilliams.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/bjornwilliams.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/bjornwilliams.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/bjornwilliams.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/bjornwilliams.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/bjornwilliams.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/bjornwilliams.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/bjornwilliams.wordpress.com/26/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=bjornwilliams.wordpress.com&amp;blog=2314322&amp;post=26&amp;subd=bjornwilliams&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://bjornwilliams.wordpress.com/2009/07/13/how-to-implement-custom-rounding-procedures/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/572d9121966c28fabcae6ce56a46f369?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">bjornwilliams</media:title>
		</media:content>
	</item>
		<item>
		<title>How to count # of character occurrences in a string .NET vERSION</title>
		<link>http://bjornwilliams.wordpress.com/2009/02/05/how-to-count-of-character-occurrences-in-a-string-net-version/</link>
		<comments>http://bjornwilliams.wordpress.com/2009/02/05/how-to-count-of-character-occurrences-in-a-string-net-version/#comments</comments>
		<pubDate>Thu, 05 Feb 2009 15:35:12 +0000</pubDate>
		<dc:creator>bjornwilliams</dc:creator>
				<category><![CDATA[T-SQL in SQL Server 2005]]></category>

		<guid isPermaLink="false">http://bjornwilliams.wordpress.com/?p=20</guid>
		<description><![CDATA[ A quick way to find the number of occurrences of a character in a string could go something as shown below.   Dim x As String =  &#8220;aa:bb:cc:dd&#8221;  Dim num As Integer = Len(x) &#8211; Len(Replace(x, &#8220;:&#8221;, &#8220;&#8221;))<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=bjornwilliams.wordpress.com&amp;blog=2314322&amp;post=20&amp;subd=bjornwilliams&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p> <span style="font-size:12px;color:#0000ff;"><span style="font-size:x-small;color:#0000ff;">A quick way to find the number of occurrences of a character in a string could go something as shown below.</span></span><span style="font-size:12px;color:#0000ff;"><span style="font-size:x-small;color:#0000ff;"> </span></span><span style="font-size:12px;color:#0000ff;"><span style="font-size:x-small;color:#0000ff;"> </p>
<p></span></span></p>
<p><span style="font-size:12px;color:#0000ff;"><span style="font-size:x-small;color:#0000ff;">Dim</span></span><span style="font-size:12px;"> x </span><span style="font-size:x-small;color:#0000ff;"><span style="font-size:x-small;color:#0000ff;">As</span></span><span style="font-size:x-small;"> </span><span style="font-size:x-small;color:#0000ff;"><span style="font-size:x-small;color:#0000ff;">String</span></span><span style="font-size:x-small;"> =  </span><span style="font-size:x-small;color:#a31515;"><span style="font-size:x-small;color:#a31515;">&#8220;aa:bb:cc:dd&#8221;</span></span></p>
<div><span style="font-size:x-small;"><span style="font-size:x-small;"> </span></span><span style="font-size:x-small;color:#0000ff;"><span style="font-size:x-small;color:#0000ff;">Dim </span></span><span style="font-size:x-small;">num </span><span style="font-size:x-small;color:#0000ff;"><span style="font-size:x-small;color:#0000ff;">As</span></span><span style="font-size:x-small;"> </span><span style="font-size:x-small;color:#0000ff;"><span style="font-size:x-small;color:#0000ff;">Integer</span></span><span style="font-size:x-small;"> = Len(x) &#8211; Len(Replace(x, </span><span style="font-size:x-small;color:#a31515;"><span style="font-size:x-small;color:#a31515;">&#8220;:&#8221;</span></span><span style="font-size:x-small;">, </span><span style="font-size:x-small;color:#a31515;"><span style="font-size:x-small;color:#a31515;">&#8220;&#8221;</span></span><span style="font-size:x-small;">))</span></div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/bjornwilliams.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/bjornwilliams.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/bjornwilliams.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/bjornwilliams.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/bjornwilliams.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/bjornwilliams.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/bjornwilliams.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/bjornwilliams.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/bjornwilliams.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/bjornwilliams.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/bjornwilliams.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/bjornwilliams.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/bjornwilliams.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/bjornwilliams.wordpress.com/20/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=bjornwilliams.wordpress.com&amp;blog=2314322&amp;post=20&amp;subd=bjornwilliams&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://bjornwilliams.wordpress.com/2009/02/05/how-to-count-of-character-occurrences-in-a-string-net-version/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/572d9121966c28fabcae6ce56a46f369?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">bjornwilliams</media:title>
		</media:content>
	</item>
		<item>
		<title>How to count # of character occurrences in a string</title>
		<link>http://bjornwilliams.wordpress.com/2009/02/05/how-to-count-of-character-occurrences-in-a-string/</link>
		<comments>http://bjornwilliams.wordpress.com/2009/02/05/how-to-count-of-character-occurrences-in-a-string/#comments</comments>
		<pubDate>Thu, 05 Feb 2009 15:11:54 +0000</pubDate>
		<dc:creator>bjornwilliams</dc:creator>
				<category><![CDATA[T-SQL in SQL Server 2005]]></category>

		<guid isPermaLink="false">http://bjornwilliams.wordpress.com/?p=14</guid>
		<description><![CDATA[ A quick and dirty way would be to use an expression like length(x) &#8211; length(replace(x, &#8220;:&#8221;, &#8220;&#8221;)) Here&#8217;s some code that I actually ran: set @x = &#8220;aa:bb:cc:dd&#8221;; set @colons = length(@x) &#8211; length(replace(@x, &#8220;:&#8221;, &#8220;&#8221;)); select @x ,  @colons;   Example 2: try to count how many times p appears in word &#8216;Mississippi&#8217; select [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=bjornwilliams.wordpress.com&amp;blog=2314322&amp;post=14&amp;subd=bjornwilliams&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p> A quick and dirty way would be to use an expression like</p>
<p>length(x) &#8211; length(replace(x, &#8220;:&#8221;, &#8220;&#8221;))</p>
<p>Here&#8217;s some code that I actually ran:</p>
<p>set @x = &#8220;aa:bb:cc:dd&#8221;;<br />
set @colons = length(@x) &#8211; length(replace(@x, &#8220;:&#8221;, &#8220;&#8221;));<br />
select @x ,  @colons;</p>
<p> </p>
<p>Example 2:</p>
<p><span style="font-size:x-small;">try to count how many times p appears in word &#8216;Mississippi&#8217;</p>
<p><span style="font-size:x-small;">select len(&#8216;Mississippi&#8217;) &#8211; len(replace(&#8216;Mississippi&#8217;, &#8216;p&#8217;, &#8221;)) </span></p>
<p></span></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/bjornwilliams.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/bjornwilliams.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/bjornwilliams.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/bjornwilliams.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/bjornwilliams.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/bjornwilliams.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/bjornwilliams.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/bjornwilliams.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/bjornwilliams.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/bjornwilliams.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/bjornwilliams.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/bjornwilliams.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/bjornwilliams.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/bjornwilliams.wordpress.com/14/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=bjornwilliams.wordpress.com&amp;blog=2314322&amp;post=14&amp;subd=bjornwilliams&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://bjornwilliams.wordpress.com/2009/02/05/how-to-count-of-character-occurrences-in-a-string/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/572d9121966c28fabcae6ce56a46f369?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">bjornwilliams</media:title>
		</media:content>
	</item>
		<item>
		<title>Easier way to manage your ASP.NET Cache</title>
		<link>http://bjornwilliams.wordpress.com/2008/06/29/easier-way-to-manage-your-aspnet-cache/</link>
		<comments>http://bjornwilliams.wordpress.com/2008/06/29/easier-way-to-manage-your-aspnet-cache/#comments</comments>
		<pubDate>Sun, 29 Jun 2008 16:48:10 +0000</pubDate>
		<dc:creator>bjornwilliams</dc:creator>
				<category><![CDATA[ASP.NET Cache]]></category>

		<guid isPermaLink="false">http://bjornwilliams.wordpress.com/?p=12</guid>
		<description><![CDATA[I was recently told by a client of mine that the ASP.NET app I developed was WAY TOO SLOW! I had to agree; the site was pinging the database twice on every load of the home page. So I said, &#8220;Give me a week&#8230; I&#8217;ll make it work better&#8221;. I went home feeling bad&#8230; my [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=bjornwilliams.wordpress.com&amp;blog=2314322&amp;post=12&amp;subd=bjornwilliams&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I was recently told by a client of mine that the ASP.NET app I developed was WAY TOO SLOW! I had to agree; the site was pinging the database twice on every load of the home page. So I said, &#8220;Give me a week&#8230; I&#8217;ll make it work better&#8221;. I went home feeling bad&#8230; my app was slow and I really didn&#8217;t know where to begin. I had a lot of code that depended on pinging the database and I didn&#8217;t want to sift through it all. What I ended up doing was using the cache object.</p>
<p>I started to look at other open source projects and their approaches to caching. Than DotNetKicks&#8217; cache manager caught my eye! I went off that idea and created my own way of implementing an object to interface with the cache object, making it more manageable.</p>
<p>The Cache manager I wrote has 3 methods (Grab, insert, clear), a constructor and 2 properties (CacheKey, CacheDuration). So here&#8217;s my code in VB and C#:</p>
<p><span class="kwrd">using</span> System.Web;<br />
<span class="kwrd">using</span> System.Web.Caching;<br />
<span class="kwrd">namespace</span> MainSite.Cache<br />
{<br />
  <span class="kwrd">public</span> <span class="kwrd">class</span> CacheManager&lt;T&gt;<br />
  {<br />
    <span class="kwrd">private</span> <span class="kwrd">string</span> m_cachekey = <span class="str">&#8220;&#8221;</span>;<br />
    <span class="kwrd">public</span> <span class="kwrd">string</span> CacheKey {<br />
      get { <span class="kwrd">return</span> m_cachekey; }<br />
      set { m_cachekey = <span class="kwrd">value</span>; }<br />
    }</p>
<p>    <span class="kwrd">private</span> <span class="kwrd">int</span> m_cacheduration;<br />
    <span class="kwrd">public</span> <span class="kwrd">int</span> CacheDuration {<br />
      get { <span class="kwrd">return</span> m_cacheduration; }<br />
      set { m_cacheduration = <span class="kwrd">value</span>; }<br />
    }</p>
<p>    <span class="kwrd">public</span> CacheManager(<span class="kwrd">string</span> Key, <span class="kwrd">int</span> duration)<br />
    {<br />
      <span class="kwrd">this</span>.CacheKey = Key;<br />
      <span class="kwrd">this</span>.CacheDuration = duration;<br />
    }</p>
<p>    <span class="kwrd">public</span> T Grab()<br />
    {<br />
      <span class="kwrd">return</span> (T)HttpContext.Current.Cache(<span class="kwrd">this</span>.CacheKey);<br />
    }</p>
<p>    <span class="kwrd">public</span> <span class="kwrd">void</span> Insert(T obj, System.Web.Caching.CacheItemPriority priority)<br />
    {<br />
      DateTime expiration = DateTime.Now.AddMinutes(<span class="kwrd">this</span>.CacheDuration);<br />
      HttpContext.Current.Cache.Add(<span class="kwrd">this</span>.CacheKey, obj, <span class="kwrd">null</span>, expiration, TimeSpan.Zero, priority, <span class="kwrd">null</span>);<br />
    }</p>
<p>    <span class="kwrd">public</span> <span class="kwrd">void</span> Clear()<br />
    {<br />
      HttpContext.Current.Cache.Remove(<span class="kwrd">this</span>.CacheKey);<br />
    }</p>
<p>  }<br />
}</p>
<p>So what I do is create a class and have a grab method that makes an instance of the cache manager object and calls the cache manager class&#8217; grab method. If the cache returns null, I have a private method in my class that does the nesessary things to put the info into the cache object. Here&#8217;s an example:<br />
<span class="kwrd">namespace</span> MainSite.Cache<br />
{<br />
  <span class="kwrd">public</span> <span class="kwrd">class</span> ReviewsCache<br />
  {<br />
    <span class="kwrd">public</span> <span class="kwrd">static</span> ReviewsCollection Grab()<br />
    {<br />
      CacheManager&lt;ReviewsCollection&gt; man = <span class="kwrd">new</span> CacheManager&lt;ReviewsCollection&gt;(GetKey(), 90);</p>
<p>      ReviewsCollection cont = man.Grab();</p>
<p>      <span class="kwrd">if</span> (cont == <span class="kwrd">null</span>) cont = Insert(man); </p>
<p>      <span class="kwrd">return</span> cont;<br />
    }</p>
<p>    <span class="kwrd">private</span> <span class="kwrd">static</span> ReviewsCollection Insert(CacheManager&lt;ReviewsCollection&gt; man)<br />
    {<br />
      ReviewsCollection cont = MainSite.Logic.Reviews.GetAll();<br />
      man.Insert(cont, Web.Caching.CacheItemPriority.Default);<br />
      <span class="kwrd">return</span> cont;<br />
    }</p>
<p>    <span class="kwrd">public</span> <span class="kwrd">static</span> <span class="kwrd">void</span> Delete(<span class="kwrd">string</span> sectionname)<br />
    {<br />
      CacheManager&lt;ReviewsCollection&gt; man = <span class="kwrd">new</span> CacheManager&lt;ReviewsCollection&gt;(GetKey(), 90);<br />
      man.Clear();<br />
    }</p>
<p>    <span class="kwrd">private</span> <span class="kwrd">static</span> <span class="kwrd">string</span> GetKey()<br />
    {<br />
      <span class="kwrd">return</span> <span class="str">&#8220;Reviews&#8221;</span>;<br />
    }</p>
<p>  }<br />
}<br />
The cache object is a great thing to utilize in ASP.NET. But to make the caching manageable, you need to have a structure for managing the cache object and add logic to delete, grab, etc. Interfacing with a class is easier and follows the MVC pattern better than just saying Cache["MyKey"] in your logic or UI.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/bjornwilliams.wordpress.com/12/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/bjornwilliams.wordpress.com/12/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/bjornwilliams.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/bjornwilliams.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/bjornwilliams.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/bjornwilliams.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/bjornwilliams.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/bjornwilliams.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/bjornwilliams.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/bjornwilliams.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/bjornwilliams.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/bjornwilliams.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/bjornwilliams.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/bjornwilliams.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/bjornwilliams.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/bjornwilliams.wordpress.com/12/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=bjornwilliams.wordpress.com&amp;blog=2314322&amp;post=12&amp;subd=bjornwilliams&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://bjornwilliams.wordpress.com/2008/06/29/easier-way-to-manage-your-aspnet-cache/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/572d9121966c28fabcae6ce56a46f369?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">bjornwilliams</media:title>
		</media:content>
	</item>
		<item>
		<title>Working with Dates and Time in ASP.NET</title>
		<link>http://bjornwilliams.wordpress.com/2008/06/25/working-with-dates-and-time-in-aspnet/</link>
		<comments>http://bjornwilliams.wordpress.com/2008/06/25/working-with-dates-and-time-in-aspnet/#comments</comments>
		<pubDate>Wed, 25 Jun 2008 13:37:25 +0000</pubDate>
		<dc:creator>bjornwilliams</dc:creator>
				<category><![CDATA[DATE Manipulation]]></category>

		<guid isPermaLink="false">http://bjornwilliams.wordpress.com/?p=7</guid>
		<description><![CDATA[First we set the initial DateTime variable as follows: Dim dtNow As DateTime = DateTime.Now Now we can use this variable to manipulate today&#8217;s date to give us the exact format that we need. 6/25/2008 litDate.Text = dtNow.Date 6/25/2008 litToday.Text = dtNow.Today 6/25/2008 litToShortDateString.Text = dtNow.ToShortDateString 8:26 AM litToShortTimeString.Text = dtNow.ToShortTimeString Wednesday, June 25, 2008 [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=bjornwilliams.wordpress.com&amp;blog=2314322&amp;post=7&amp;subd=bjornwilliams&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>First we set the initial DateTime variable as follows:</p>
<p><span style="color:#0000ff;">Dim dtNow As DateTime = DateTime.Now</span></p>
<p>Now we can use this variable to manipulate today&#8217;s date to give us the exact format that we need.</p>
<table border="0" cellspacing="1" cellpadding="5" width="475" align="center" bgcolor="#999999">
<tbody>
<tr>
<td class="basix" bgcolor="#eeeeee">6/25/2008</td>
</tr>
<tr>
<td class="basix" bgcolor="#ffffff">litDate.Text = dtNow.Date</td>
</tr>
</tbody>
</table>
<table border="0" cellspacing="1" cellpadding="5" width="475" align="center" bgcolor="#999999">
<tbody>
<tr>
<td class="basix" bgcolor="#eeeeee">6/25/2008</td>
</tr>
<tr>
<td class="basix" bgcolor="#ffffff">litToday.Text = dtNow.Today</td>
</tr>
</tbody>
</table>
<table border="0" cellspacing="1" cellpadding="5" width="475" align="center" bgcolor="#999999">
<tbody>
<tr>
<td class="basix" bgcolor="#eeeeee">6/25/2008</td>
</tr>
<tr>
<td class="basix" bgcolor="#ffffff">litToShortDateString.Text = dtNow.ToShortDateString</td>
</tr>
</tbody>
</table>
<table border="0" cellspacing="1" cellpadding="5" width="475" align="center" bgcolor="#999999">
<tbody>
<tr>
<td class="basix" bgcolor="#eeeeee">8:26 AM</td>
</tr>
<tr>
<td class="basix" bgcolor="#ffffff">litToShortTimeString.Text = dtNow.ToShortTimeString</td>
</tr>
</tbody>
</table>
<table border="0" cellspacing="1" cellpadding="5" width="475" align="center" bgcolor="#999999">
<tbody>
<tr>
<td class="basix" bgcolor="#eeeeee">Wednesday, June 25, 2008</td>
</tr>
<tr>
<td class="basix" bgcolor="#ffffff">litToLongDateString.Text = dtNow.ToLongDateString</td>
</tr>
</tbody>
</table>
<table border="0" cellspacing="1" cellpadding="5" width="475" align="center" bgcolor="#999999">
<tbody>
<tr>
<td class="basix" bgcolor="#eeeeee">8:26:46 AM</td>
</tr>
<tr>
<td class="basix" bgcolor="#ffffff">litToLongTimeString.Text = dtNow.ToLongTimeString</td>
</tr>
</tbody>
</table>
<table border="0" cellspacing="1" cellpadding="5" width="475" align="center" bgcolor="#999999">
<tbody>
<tr>
<td class="basix" bgcolor="#eeeeee">6/25/2008 1:26:46 PM</td>
</tr>
<tr>
<td class="basix" bgcolor="#ffffff">litToUniversalTime.Text = dtNow.ToUniversalTime</td>
</tr>
</tbody>
</table>
<table border="0" cellspacing="1" cellpadding="5" width="475" align="center" bgcolor="#999999">
<tbody>
<tr>
<td class="basix" bgcolor="#eeeeee">177</td>
</tr>
<tr>
<td class="basix" bgcolor="#ffffff">litDayOfYear.Text = dtNow.DayOfYear</td>
</tr>
</tbody>
</table>
<table border="0" cellspacing="1" cellpadding="5" width="475" align="center" bgcolor="#999999">
<tbody>
<tr>
<td class="basix" bgcolor="#eeeeee">3</td>
</tr>
<tr>
<td class="basix" bgcolor="#ffffff">litDayOfWeek.Text = dtNow.DayOfWeek</td>
</tr>
</tbody>
</table>
<table border="0" cellspacing="1" cellpadding="5" width="475" align="center" bgcolor="#999999">
<tbody>
<tr>
<td class="basix" bgcolor="#eeeeee">6</td>
</tr>
<tr>
<td class="basix" bgcolor="#ffffff">litDay.Text = dtNow.Month</td>
</tr>
</tbody>
</table>
<table border="0" cellspacing="1" cellpadding="5" width="475" align="center" bgcolor="#999999">
<tbody>
<tr>
<td class="basix" bgcolor="#eeeeee">25</td>
</tr>
<tr>
<td class="basix" bgcolor="#ffffff">litDay.Text = dtNow.Day</td>
</tr>
</tbody>
</table>
<table border="0" cellspacing="1" cellpadding="5" width="475" align="center" bgcolor="#999999">
<tbody>
<tr>
<td class="basix" bgcolor="#eeeeee">2008</td>
</tr>
<tr>
<td class="basix" bgcolor="#ffffff">litDay.Text = dtNow.Year</td>
</tr>
</tbody>
</table>
<table border="0" cellspacing="1" cellpadding="5" width="475" align="center" bgcolor="#999999">
<tbody>
<tr>
<td class="basix" bgcolor="#eeeeee">6/26/2008 8:26:46 AM</td>
</tr>
<tr>
<td class="basix" bgcolor="#ffffff">litAddDays.Text = dtNow.AddDays(1)</td>
</tr>
</tbody>
</table>
<table border="0" cellspacing="1" cellpadding="5" width="475" align="center" bgcolor="#999999">
<tbody>
<tr>
<td class="basix" bgcolor="#eeeeee">6/25/2008 9:26:46 AM</td>
</tr>
<tr>
<td class="basix" bgcolor="#ffffff">litAddHours.Text = dtNow.AddHours(1)</td>
</tr>
</tbody>
</table>
<table border="0" cellspacing="1" cellpadding="5" width="475" align="center" bgcolor="#999999">
<tbody>
<tr>
<td class="basix" bgcolor="#eeeeee">6/25/2008 8:26:56 AM</td>
</tr>
<tr>
<td class="basix" bgcolor="#ffffff">litAddMilliseconds.Text = dtNow.AddMilliseconds(10000)</td>
</tr>
</tbody>
</table>
<table border="0" cellspacing="1" cellpadding="5" width="475" align="center" bgcolor="#999999">
<tbody>
<tr>
<td class="basix" bgcolor="#eeeeee">6/25/2008 8:27:46 AM</td>
</tr>
<tr>
<td class="basix" bgcolor="#ffffff">litAddMinutes.Text = dtNow.AddMinutes(1)</td>
</tr>
</tbody>
</table>
<table border="0" cellspacing="1" cellpadding="5" width="475" align="center" bgcolor="#999999">
<tbody>
<tr>
<td class="basix" bgcolor="#eeeeee">7/25/2008 8:26:46 AM</td>
</tr>
<tr>
<td class="basix" bgcolor="#ffffff">litAddMonths.Text = dtNow.AddMonths(1)</td>
</tr>
</tbody>
</table>
<table border="0" cellspacing="1" cellpadding="5" width="475" align="center" bgcolor="#999999">
<tbody>
<tr>
<td class="basix" bgcolor="#eeeeee">6/25/2008 8:26:47 AM</td>
</tr>
<tr>
<td class="basix" bgcolor="#ffffff">litAddSeconds.Text = dtNow.AddSeconds(1)</td>
</tr>
</tbody>
</table>
<table border="0" cellspacing="1" cellpadding="5" width="475" align="center" bgcolor="#999999">
<tbody>
<tr>
<td class="basix" bgcolor="#eeeeee">6/26/2008 12:13:26 PM</td>
</tr>
<tr>
<td class="basix" bgcolor="#ffffff">litAddTicks.Text = dtNow.AddTicks(1000000000000)</td>
</tr>
</tbody>
</table>
<table border="0" cellspacing="1" cellpadding="5" width="475" align="center" bgcolor="#999999">
<tbody>
<tr>
<td class="basix" bgcolor="#eeeeee">6/25/2009 8:26:46 AM</td>
</tr>
<tr>
<td class="basix" bgcolor="#ffffff">litAddYears.Text = dtNow.AddYears(1)</td>
</tr>
</tbody>
</table>
<table id="Table1" border="0" cellspacing="1" cellpadding="5" width="475" align="center" bgcolor="#999999">
<tbody>
<tr>
<td class="basix" bgcolor="#eeeeee">6/24/2008 8:26:46 AM</td>
</tr>
<tr>
<td class="basix" bgcolor="#ffffff">litAddNegDays.Text = dtNow.AddDays(-1)</td>
</tr>
</tbody>
</table>
<table id="Table2" border="0" cellspacing="1" cellpadding="5" width="475" align="center" bgcolor="#999999">
<tbody>
<tr>
<td class="basix" bgcolor="#eeeeee">6/25/2007 8:26:46 AM</td>
</tr>
<tr>
<td class="basix" bgcolor="#ffffff">litAddNegYears.Text = dtNow.AddYears(-1)</td>
</tr>
</tbody>
</table>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/bjornwilliams.wordpress.com/7/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/bjornwilliams.wordpress.com/7/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/bjornwilliams.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/bjornwilliams.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/bjornwilliams.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/bjornwilliams.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/bjornwilliams.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/bjornwilliams.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/bjornwilliams.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/bjornwilliams.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/bjornwilliams.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/bjornwilliams.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/bjornwilliams.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/bjornwilliams.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/bjornwilliams.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/bjornwilliams.wordpress.com/7/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=bjornwilliams.wordpress.com&amp;blog=2314322&amp;post=7&amp;subd=bjornwilliams&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://bjornwilliams.wordpress.com/2008/06/25/working-with-dates-and-time-in-aspnet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/572d9121966c28fabcae6ce56a46f369?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">bjornwilliams</media:title>
		</media:content>
	</item>
		<item>
		<title>How to invoke events across User Controls in ASP.NET</title>
		<link>http://bjornwilliams.wordpress.com/2008/06/10/how-to-invoke-events-across-user-controls-in-aspnet/</link>
		<comments>http://bjornwilliams.wordpress.com/2008/06/10/how-to-invoke-events-across-user-controls-in-aspnet/#comments</comments>
		<pubDate>Tue, 10 Jun 2008 01:08:56 +0000</pubDate>
		<dc:creator>bjornwilliams</dc:creator>
				<category><![CDATA[UserControls]]></category>

		<guid isPermaLink="false">http://bjornwilliams.wordpress.com/?p=5</guid>
		<description><![CDATA[I want my code to avoid all the middle men, to be foolproof with clear and visible usage, and to be simple to use. That suggests we should declare our events the usual way, all listeners should register themselves the usual way, there should be no more than one line of code to forward the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=bjornwilliams.wordpress.com&amp;blog=2314322&amp;post=5&amp;subd=bjornwilliams&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I want my code to avoid all the middle men, to be foolproof with clear and visible usage, and to be simple to use. That suggests we should declare our events the usual way, all listeners should register themselves the usual way, there should be no more than one line of code to forward the event, and the forwarding should happen once.</p>
<p>So we need something to expose the events and methods to invoke them:</p>
<ul>
<li>Events and notification methods come in pairs.</li>
<li>Notifiers and listeners use the same object.</li>
<li>The object will keep track of the event handler delegates in <code>Context.Items</code>.</li>
</ul>
<p>In the provided code, I have one User Control with two buttons to invoke events, and another User Control to receive them. I used a regular <code>Button</code> and an <code>ImageButton</code> to demonstrate event handlers with different argument types.</p>
<p>The sender control uses the following code to invoke the events:</p>
<pre><span class="code-keyword">private</span> ButtonEvents events;

<span class="code-keyword">private</span> <span class="code-keyword">void</span> Page_Load (<span class="code-keyword">object</span> sender, EventArgs e)
{
    events = <span class="code-keyword">new</span> ButtonEvents(Context.Items);
}

<span class="code-keyword">private</span> <span class="code-keyword">void</span> uxButton_Click (<span class="code-keyword">object</span> sender, EventArgs e)
{
    events.ClickButton(sender, e);
}

<span class="code-keyword">private</span> <span class="code-keyword">void</span> uxImage_Click (<span class="code-keyword">object</span> sender, ImageClickEventArgs e)
{
    events.ClickImageButton(sender, e);
}</pre>
<p>The receiver control uses this code to register to those events:</p>
<pre><span class="code-keyword">private</span> <span class="code-keyword">void</span> Page_Load (<span class="code-keyword">object</span> sender, EventArgs e)
{
    ButtonEvents events = <span class="code-keyword">new</span> ButtonEvents(Context.Items);
    events.ImageButtonClicked +=
             <span class="code-keyword">new</span> ImageClickEventHandler(events_ImageButtonClicked);
    events.ButtonClicked += <span class="code-keyword">new</span> EventHandler(events_ButtonClicked);
}</pre>
<p>The <code>ButtonEvents</code> class needs a little more work than usual to implement, but not much:</p>
<div id="premain2" class="precollapse" style="width:100%;"><img style="cursor:pointer;" src="http://www.codeproject.com/images/minus.gif" alt="" width="9" height="9" /><span style="margin-bottom:0;cursor:pointer;"> Collapse</span></div>
<pre style="margin-top:0;"><span class="code-keyword">internal</span> <span class="code-keyword">class</span> ButtonEvents
{
    <span class="code-keyword">private</span> CachedEvent buttonEvent;
    <span class="code-keyword">private</span> CachedEvent imageButtonEvent;

    <span class="code-keyword">public</span> ButtonEvents (IDictionary items)
    {
        buttonEvent = <span class="code-keyword">new</span> CachedEvent(items, <span class="code-string">"</span><span class="code-string">Button"</span>);
        imageButtonEvent = <span class="code-keyword">new</span> CachedEvent(items, <span class="code-string">"</span><span class="code-string">ImageButton"</span>);
    }

    <span class="code-keyword">public</span> <span class="code-keyword">event</span> ImageClickEventHandler ImageButtonClicked
    {
        add { imageButtonEvent.Add(value);}
        remove { imageButtonEvent.Remove(value);}
    }

    <span class="code-keyword">public</span> <span class="code-keyword">event</span> EventHandler ButtonClicked
    {
        add { buttonEvent.Add(value);}
        remove { buttonEvent.Remove(value);}
    }

    <span class="code-keyword">public</span> <span class="code-keyword">void</span> ClickButton (<span class="code-keyword">object</span> sender, EventArgs e)
    {
        buttonEvent.Invoke(sender, e);
    }

    <span class="code-keyword">public</span> <span class="code-keyword">void</span> ClickImageButton (<span class="code-keyword">object</span> sender, ImageClickEventArgs e)
    {
        imageButtonEvent.Invoke(sender, e);
    }
}</pre>
<p>The <code>ButtonEvents</code> class makes use of the <code>CachedEvent</code> helper object. This is the object which implements the real solution. The <code>CachedEvents</code> takes a dictionary and a key in its constructor, so it knows where to store the event handlers. The event handlers are delegates, and are stored as such:</p>
<pre><span class="code-keyword">public</span> CachedEvent (IDictionary items, <span class="code-keyword">object</span> key)
{
    <span class="code-keyword">this</span>.items = items;
    <span class="code-keyword">this</span>.key = key;
}

<span class="code-keyword">private</span> Delegate Listeners
{
    <span class="code-keyword">set</span> { items [key] = value; }
    <span class="code-keyword">get</span> { <span class="code-keyword">return</span> (Delegate) items [key]; }
}</pre>
<p>There are two helper methods to register and unregister event listeners:</p>
<pre><span class="code-keyword">public</span> <span class="code-keyword">void</span> Add (MulticastDelegate newListener)
{
    Listeners = Delegate.Combine(Listeners, newListener);
}

<span class="code-keyword">public</span> <span class="code-keyword">void</span> Remove (MulticastDelegate formerListener)
{
    Listeners = Delegate.Remove(Listeners, formerListener);
}</pre>
<p>And finally, the method to invoke the event:</p>
<pre><span class="code-keyword">public</span> <span class="code-keyword">void</span> Invoke (<span class="code-keyword">object</span> sender, EventArgs arguments)
{
    Delegate listeners = Listeners;
    <span class="code-keyword">if</span> (listeners != <span class="code-keyword">null</span>)
        listeners.DynamicInvoke(<span class="code-keyword">new</span> <span class="code-keyword">object</span>[] {sender, arguments});
}</pre>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/bjornwilliams.wordpress.com/5/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/bjornwilliams.wordpress.com/5/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/bjornwilliams.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/bjornwilliams.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/bjornwilliams.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/bjornwilliams.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/bjornwilliams.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/bjornwilliams.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/bjornwilliams.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/bjornwilliams.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/bjornwilliams.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/bjornwilliams.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/bjornwilliams.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/bjornwilliams.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/bjornwilliams.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/bjornwilliams.wordpress.com/5/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=bjornwilliams.wordpress.com&amp;blog=2314322&amp;post=5&amp;subd=bjornwilliams&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://bjornwilliams.wordpress.com/2008/06/10/how-to-invoke-events-across-user-controls-in-aspnet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/572d9121966c28fabcae6ce56a46f369?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">bjornwilliams</media:title>
		</media:content>

		<media:content url="http://www.codeproject.com/images/minus.gif" medium="image" />
	</item>
		<item>
		<title>HttpCacheVaryByParams Class</title>
		<link>http://bjornwilliams.wordpress.com/2007/12/13/hello-world/</link>
		<comments>http://bjornwilliams.wordpress.com/2007/12/13/hello-world/#comments</comments>
		<pubDate>Thu, 13 Dec 2007 03:54:37 +0000</pubDate>
		<dc:creator>bjornwilliams</dc:creator>
				<category><![CDATA[DHL API]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Provides a type-safe way to set the VaryByParams property. Response.Cache.SetExpires(DateTime.Now.AddSeconds(60)) Response.Cache.SetCacheability(HttpCacheability.Public) Response.Cache.SetValidUntilExpires(False) Response.Cache.VaryByParams(&#8220;Category&#8221;) = True If Response.Cache.VaryByParams(&#8220;Category&#8221;) Then    &#8216;&#8230; End If<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=bjornwilliams.wordpress.com&amp;blog=2314322&amp;post=1&amp;subd=bjornwilliams&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Provides a type-safe way to set the <a id="ctl00_rs1_mainContentContainer_ctl02" href="http://msdn.microsoft.com/en-us/library/system.web.httpcachepolicy.varybyparams.aspx">VaryByParams</a> property.</p>
<p>Response.Cache.SetExpires(DateTime.Now.AddSeconds(60))<br />
Response.Cache.SetCacheability(HttpCacheability.Public)<br />
Response.Cache.SetValidUntilExpires(<span style="color:blue;">False</span>)<br />
Response.Cache.VaryByParams(<span style="color:maroon;">&#8220;Category&#8221;</span>) = <span style="color:blue;">True</span></p>
<p><span style="color:blue;">If</span> Response.Cache.VaryByParams(<span style="color:maroon;">&#8220;Category&#8221;</span>) <span style="color:blue;">Then</span><br />
   <span style="color:green;">&#8216;&#8230;</span><br />
<span style="color:blue;">End</span> <span style="color:blue;">If</span></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/bjornwilliams.wordpress.com/1/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/bjornwilliams.wordpress.com/1/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/bjornwilliams.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/bjornwilliams.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/bjornwilliams.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/bjornwilliams.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/bjornwilliams.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/bjornwilliams.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/bjornwilliams.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/bjornwilliams.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/bjornwilliams.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/bjornwilliams.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/bjornwilliams.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/bjornwilliams.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/bjornwilliams.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/bjornwilliams.wordpress.com/1/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=bjornwilliams.wordpress.com&amp;blog=2314322&amp;post=1&amp;subd=bjornwilliams&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://bjornwilliams.wordpress.com/2007/12/13/hello-world/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/572d9121966c28fabcae6ce56a46f369?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">bjornwilliams</media:title>
		</media:content>
	</item>
	</channel>
</rss>
