Javascript function to set cookie value
<p>I am new to programming and trying to write a javascript function to set a cookie value when a popup button is clicked. </p>

<p>In home.aspx</p>

<pre><code>&lt;input id="btnCanOK2" type="button" value="Close" class="popupButton" runat="server" onclick="return btnClose_Click" /&gt;
</code></pre>

<p>for this button, i have written a javascript function:</p>

<pre><code>function btnClose_Click()
{  
document.cookie = 'cookieName=closed; value=dontshowagain';
} 
</code></pre>

<p>In merchant.login page</p>

<p>In the code behind of the other page, it has to check if the value of the cookie is set to "dontshowagain". If it is set to the value, the function should not show the popup again. My task is not to show the popup in different pages. If it is closed once, it has to stop showing again until the browser is closed.</p>

<pre><code>if (Request.Cookies["closed"] == null)
{
ModalPopupextender2.Show();
}
else if(Request.Cookies["closed"].Tostring() == "dontshowagain")
{
ModalPopupextender2.Hide();
}
</code></pre>

<p>Where am i doing wrong?? Now Cookie value is always null :(</p>

<p>Thanks a lot in advance. </p>
