snipt

Ctrl+h for KB shortcuts

VB.net

VB.Net Check for an Empty Session Variable

1
2
3
4
5
If Session("YourVar") Is Nothing Then
    ' Do something here...
Else
    ' Do something else here...
End If
https://snipt.net/embed/3271f2998c72fc676a03bf630502573f/
https://snipt.net/raw/3271f2998c72fc676a03bf630502573f/
3271f2998c72fc676a03bf630502573f
vb.net
VB.net
5
2016-09-28T12:47:41
True
False
False
/api/public/snipt/49344/
vbnet-check-for-an-empty-session-variable
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a><span class="k">If</span> <span class="n">Session</span><span class="p">(</span><span class="s">&quot;YourVar&quot;</span><span class="p">)</span> <span class="ow">Is</span> <span class="k">Nothing</span> <span class="k">Then</span> </span><span id="L-2"><a name="L-2"></a> <span class="c">&#39; Do something here...</span> </span><span id="L-3"><a name="L-3"></a><span class="k">Else</span> </span><span id="L-4"><a name="L-4"></a> <span class="c">&#39; Do something else here...</span> </span><span id="L-5"><a name="L-5"></a><span class="k">End</span> <span class="k">If</span> </span></pre></div> </td></tr></table>
"session null", session, vb.net
Copyrighted, illegal, or inappropriate content? Email support@snipt.net.