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,
before this is used session and same problem , Null session, i posted severalllllllllllllll posts regarding taht issue and was adviced to use cookies and now see what is happening people :( ... help please ?
Hunain Hafee...
Member
238 Points
639 Posts
cookies null
Dec 27, 2012 10:13 PM|LINK
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.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,
Code:
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"); }before this is used session and same problem , Null session, i posted severalllllllllllllll posts regarding taht issue and was adviced to use cookies and now see what is happening people :( ... help please ?
paindaasp
Star
12090 Points
2034 Posts
Re: cookies null
Dec 27, 2012 11:13 PM|LINK
You need to add the cookie:
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);Hunain Hafee...
Member
238 Points
639 Posts
Re: cookies null
Dec 27, 2012 11:30 PM|LINK
thanks i tried this and its must,
but still getting error
COOKIE is null
even i checked settings and cookies are enabled but not working in code ? why pleassssssssssssssssssssssssssssssssssssssssssse help
paindaasp
Star
12090 Points
2034 Posts
Re: cookies null
Dec 27, 2012 11:53 PM|LINK
Your code creates the cookie for me, although I don't log in to the PayPal Sandbox. What happend to the cookie if you don't redirect to PayPal?
sameer_khanj...
Contributor
7060 Points
1378 Posts
Re: cookies null
Dec 28, 2012 06:37 AM|LINK
String employerEmail = Request.QueryString["employerEmail"]; HttpCookie employerEmailCookie = new HttpCookie("empEmailCookie"); employerEmailCookie.Values.Add("employerEmail", employerEmail); employerEmailCookie.Values.Add("CurrentDate", DateTime.Now.ToString()); employerEmailCookie.Expires = DateTime.Now.AddMinutes(30); Response.Cookies.Add(employerEmailCookie);sameer.khanjit@gmail.com
View Blog
Click "Mark as Answer" on the post that helped you.
Hunain Hafee...
Member
238 Points
639 Posts
Re: cookies null
Dec 28, 2012 09:09 AM|LINK
same error
Hunain Hafee...
Member
238 Points
639 Posts
Re: cookies null
Dec 28, 2012 09:10 AM|LINK
yes sir, i vl handle that later if it worked :(
rafaqat007
Member
26 Points
14 Posts
Re: cookies null
Dec 28, 2012 10:03 AM|LINK
to add cookie
HttpCookie cookie = new HttpCookie("tempCookie");
cookie["employerEmail"] = employerEmail;
cookie.Expires = DateTime.Now.AddDays(10);
Response.Cookies.Add(cookie);
sameer_khanj...
Contributor
7060 Points
1378 Posts
Re: cookies null
Dec 28, 2012 10:14 AM|LINK
have you tried code provided by me ?
sameer.khanjit@gmail.com
View Blog
Click "Mark as Answer" on the post that helped you.
Hunain Hafee...
Member
238 Points
639 Posts
Re: cookies null
Dec 28, 2012 10:16 AM|LINK
yes dear , i did , but no luck :(