i put a code in my website to redirect user to paypal sandbox , after entering his email id , and storing it in session ,

in return url of paypal sandbox i mentioned a page but it doesn't work, it doesn't maintaing the session variable, it assigns null to session variable upon returning , even i checked same session variable on every page and it is working but not with the one to which paypal sandbox is returning upon succesful transaction , why ?

i think that redirection between http and https destroys session ,

help plz ?

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;

public partial class paymentSuccessful : System.Web.UI.Page
{

    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["tempSubAdmin"] == null)
        {
                Response.Redirect("wrongEmployerError.aspx");
        }
        else
        {

                String subAdminEmail = Session["tempSubAdmin"].ToString();
                String conString = "Data Source=COSANOSTRA; MultipleActiveResultSets=true; Initial Catalog=Waleed_orsfinal;Integrated Security=True";
                SqlConnection con = new SqlConnection(conString);
                String query = "Update tblUser Set paid=1 where email='" + subAdminEmail + "'";
                SqlCommand com = new SqlCommand(query, con);

                try
                {
                    con.Open();
                    com.ExecuteNonQuery();
                }
                catch (Exception exc)
                {
                    Response.Write(exc.Message);
                }
                finally
                {
                    con.Close();
                }
        }
    }
}

Recommended Answers

All 4 Replies

The issue you are experiencing is expected. Take a look at this conversation on the asp.net website regarding this topic. There are a few different ways to handle this.

http://forums.asp.net/t/1519204.aspx/1

jorgem i tried these but non of these helped :(

hmm, you may want to ask on the asp.net and/or iis.net forum as well. I've checked with some other developer friends of mine and cannot get a clear answer on the best approach. One option I got today was to store the session info in the database, which shouldnt be the answer.

ok jorgem thanks alot , u helped alot

but still no progress , i tried my best :(

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.