here in this block i am creating cookie

protected void Button1_Click(object sender, EventArgs e)
    {
        String employerEmail = Request.QueryString["employerEmail"];
        HttpCookie employerEmailCookie = new HttpCookie("empEmailCookie", "defaulfCookieValue");
        employerEmailCookie["employerEmail"] = employerEmail;
        employerEmailCookie["CurrentDate"] = DateTime.Now.ToString();
        employerEmailCookie.Expires = DateTime.Now.AddMinutes(30);
        Response.Cookies.Add(employerEmailCookie);
        Response.Redirect("https://www.sandbox.paypal.com/us/cgi-bin/webscr?cmd=_xclick&business=smile2_1355775057_biz@yahoo.com&item_name=MemberShip&amount=20¤cy=USD&return=http://127.0.0.1:57135/Online%20Recruitment%20System-Final/paymentSuccessful.aspx?emailAdmin='"+employerEmail+"' &cancel_return=https://www.google.com/" );
    }

and then when i return back to the page that i mentioned in return url (bolded part), then i always find null cookies , why ? like i used the code below at the page to which i am being returned after successful payment at paypal's sand box,

protected void Page_Load(object sender, EventArgs e)
    {
        Page.DataBind();
        HttpCookie getEmployerEmailCookie = Request.Cookies["empEmailCookie"];
        if (getEmployerEmailCookie!= null)
        {
            String employerEmail = Request.QueryString["emailAdmin"];
            if (employerEmail == getEmployerEmailCookie.Value)
            {
                Response.Write("dear'" + getEmployerEmailCookie.Value + "',Your registration is successful");
            }
            else
            {
                Response.Write("No payment made");
            }
        }
        else 
        {
            Response.Write("Cookie is null");
        }
}

but i alwasy get

else 
        {
            Response.Write("Cookie is null");
        }

evenn i checked browser settings and cookies are enabled so why ?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.