why it happen when i redirect user to PAYPAL's sandbox (https://www.sandbox.paypal.com) from my localhost then after returning to .aspx page (successful.aspx), it losses session,
e.g. SESSION["tempUser"], it works on everypage but not on Successful.aspx page, it returns null, i am working on this error for 2 weeks, but no progress,
e.g. SESSION["tempUser"], it works on everypage but not on Successful.aspx page, it returns null, i am working on this error for 2 weeks, but no progress,
Could you share the corresponding code? I want to test locally.
Best wishes,
Please mark the replies as answers if they help or unmark if not.
Feedback to us
If you are using cookieless sessions (and this problem is related to that) you need to place the session variable on the return url before you send it.
Hunain Hafee...
Member
238 Points
639 Posts
session null
Dec 18, 2012 12:03 PM|LINK
why it happen when i redirect user to PAYPAL's sandbox (https://www.sandbox.paypal.com) from my localhost then after returning to .aspx page (successful.aspx), it losses session,
e.g. SESSION["tempUser"], it works on everypage but not on Successful.aspx page, it returns null, i am working on this error for 2 weeks, but no progress,
oned_gk
All-Star
31267 Points
6394 Posts
Re: session null
Dec 18, 2012 12:16 PM|LINK
Maybe you have wrong event code that clear the session.
Hunain Hafee...
Member
238 Points
639 Posts
Re: session null
Dec 18, 2012 12:39 PM|LINK
thanks, no but thats not the problem ,
do u have any other alternative ?
geniusvishal
Star
14040 Points
2786 Posts
Re: session null
Dec 18, 2012 01:11 PM|LINK
Try something like this:
public string GetCartId() { if (HttpContext.Current.Session[CartSessionKey] == null) { if (!string.IsNullOrWhiteSpace(HttpContext.Current.User.Identity.Name)) { HttpContext.Current.Session[CartSessionKey] = HttpContext.Current.User.Identity.Name; } else { // Generate a new random GUID using System.Guid class. Guid tempCartId = Guid.NewGuid(); HttpContext.Current.Session[CartSessionKey] = tempCartId.ToString(); } } return HttpContext.Current.Session[CartSessionKey].ToString(); }http://www.asp.net/web-forms/tutorials/aspnet-45/getting-started-with-aspnet-45-web-forms/checkout-and-payment-with-paypal
http://www.asp.net/web-forms/tutorials/aspnet-45/getting-started-with-aspnet-45-web-forms/shopping-cart
My Website
www.dotnetvishal.com
Hunain Hafee...
Member
238 Points
639 Posts
Re: session null
Dec 18, 2012 01:36 PM|LINK
same problem bro !
Catherine Sh...
All-Star
23373 Points
2490 Posts
Microsoft
Re: session null
Dec 21, 2012 01:54 AM|LINK
Hi,
Could you share the corresponding code? I want to test locally.
Best wishes,
Feedback to us
Develop and promote your apps in Windows Store
hafizzeeshan
Participant
834 Points
253 Posts
Re: session null
Dec 21, 2012 02:58 AM|LINK
hi
check ur browser, may be paypal is returning u on different browser. for session browser must be same
Zeeshan Rauf
# 92-3216698206
Email : zeeshan_rouf@hotmail.com
Please mark the replies as answers if they help or unmark if not.
Hunain Hafee...
Member
238 Points
639 Posts
Re: session null
Dec 22, 2012 04:16 PM|LINK
Redirection Page:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="paypalRedirection.aspx.cs" Inherits="paypalRedirection" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>Payment</title> </head> <body> <form id="form1" runat="server"> <div> <h4> Congrats <b> <%# Session["tempSubAdminName"]%> </b>, Your basic informaton has been submitted , For full activation you need to pay via paypal. Please click the PayPal icon given below. </h4> </div> <div> <asp:HyperLink ID="homeBtnImage" runat="server" ImageUrl="~/btnPayPal.gif" NavigateUrl= "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='1234' &cancel_return=https://www.google.com/" >PayPal</asp:HyperLink> </div> <h6>Or if you don't have paypal account, click <asp:HyperLink ID="paypalSite" runat="server" NavigateUrl="https://www.sandbox.paypal.com/" >here</asp:HyperLink> </h6> </form> </body> </html>Return to this page if successful:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="paymentSuccessful.aspx.cs" Inherits="paymentSuccessful" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>Payment Successful</title> </head> <body> <form id="form1" runat="server"> <div> <h5> Dear <%# Session["tempSubAdmin"] %>, You have successfully registered , Please wait for the approval by admin. </h5> </div> </form> </body> </html>and yes i am binding data, on .cs page by using Page.DataBind();
the page where session begins :
. . . . . . . . . . . . try { con.Open(); com.ExecuteNonQuery(); Session["tempSubAdmin"] = txtemail.Text; Session["tempSubAdminName"] = txtfullname.Text; Response.Redirect("paypalRedirection.aspx?subAdmName=" + txtfullname.Text); } catch (Exception ex) { Response.Write("Error:" + ex.Message); } finally { con.Close(); //Session["tempSubAdmin"] = txtemail.Text; //Session["tempSubAdminName"] = txtfullname.Text; //Response.Redirect("paypalRedirection.aspx?subAdmName=" + txtfullname.Text); } . . . .and
Hunain Hafee...
Member
238 Points
639 Posts
Re: session null
Dec 22, 2012 07:34 PM|LINK
no,same browser
eric2820
Contributor
2777 Points
1161 Posts
Re: session null
Dec 22, 2012 07:38 PM|LINK
If you are using cookieless sessions (and this problem is related to that) you need to place the session variable on the return url before you send it.
http://www.my-msi.net/Admin
blog
If a post helps you, please mark it as Ansered, thank-you.