﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>InstantASP Community Forums / Old Forums / InstantForum.NET 4.x / Bug Reports / Closed Issues  / Cookie Exception in function GetCookieValue() / Latest Posts</title><generator>InstantForum.NET v4.1.4</generator><description>InstantASP Community Forums</description><link>http://community.instantasp.co.uk/</link><webMaster>sales@instantasp.co.uk</webMaster><lastBuildDate>Fri, 09 Jan 2009 03:37:22 GMT</lastBuildDate><ttl>20</ttl><item><title>Cookie Exception in function GetCookieValue()</title><link>http://community.instantasp.co.uk/Topic8601-45-1.aspx</link><description>The code... &lt;P&gt;[quote]value = GetCookie(Key).Value[/quote] &lt;/P&gt;&lt;P&gt;throws an exception if the cookie does not contain the &lt;EM&gt;key.&lt;/EM&gt; The solution is to check if the cookie exists before fetching this &lt;EM&gt;value&lt;/EM&gt;.  Here is the complete code for the function GetCookieValue() in file "InstantASP.Common\InstantASP.Common\HttpUtility\Cookies.vb" &lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#ff0000 size=2&gt;[quote]Public Shared Function GetCookieValue(ByVal Key As String) As String&lt;BR&gt;    Dim c As HttpCookie&lt;BR&gt;    c = GetCookie(Key)&lt;BR&gt;    If Not c Is Nothing Then&lt;BR&gt;        return System.Web.HttpContext.Current.Server.UrlDecode(c.Value)&lt;BR&gt;    End If&lt;BR&gt;End Function[/quote]&lt;/FONT&gt;</description><pubDate>Thu, 22 Sep 2005 23:30:57 GMT</pubDate><dc:creator>DanMorin</dc:creator></item></channel></rss>