that is weird, it works fine on my machine:MC.cs:
using System;
using System.Web;
using System.Web.UI;namespace MC
{  public class GlobalVariable
{
public static string ReadCookie(System.Web.UI.Page page, string CookieName) 
{  
HttpCookie cookie =   page.Request.Cookies[CookieName]; if ( null == cookie) 

page.Response.Write("<you yet to login");
return null;

cookie.Path ="/";
return cookie.Value; 

public static void WriteCookie(System.Web.UI.Page page, string CookieName,string CookieValue) 

HttpCookie cookie = new HttpCookie(CookieName,CookieValue);
cookie.Path ="/";
page.Response.Cookies.Add(cookie); 
   

}
}testMC.aspx:
<%@ Assembly src="MC.cs" %><script language="C#" runat="Server">
private void Button1_Click(object sender, System.EventArgs e)
{
MC.GlobalVariable.WriteCookie (this,"USERID","zsw");
MC.GlobalVariable.WriteCookie (this,"USERPWD","zzz");
}
private void Button2_Click(object sender, System.EventArgs e)
{
Response.Write ("Cookie ZSW value is:  "+MC.GlobalVariable.ReadCookie (this,"USERID"));
Response.Write ("Cookie ZSW value is:  "+MC.GlobalVariable.ReadCookie (this,"USERPWD"));
}</script>
<form runat="server">
<asp:Button runat="server" text="button1" onclick="Button1_Click" />
<asp:Button runat="server" text="button2" onclick="Button2_Click" />
</form>