An extension method for Session variables
<p>I created the following extension method:</p>

<pre><code>    public static bool HasHostAndUrl(this HttpSessionStateBase session)
    {
        return session["CurrentUrl"] != null &amp;&amp; session["CurrentHost"] != null;
    }
</code></pre>

<p>I also have the following that appears in my code. Is it possible I could make this into an extension method also:</p>

<pre><code>string.Format("http://{0}{1}",
   Session["CurrentHost"],
   new Uri((string)Session["CurrentUrl"]).PathAndQuery)
</code></pre>
