0

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();
                }
        }
    }
}
2
Contributors
4
Replies
5
Views
4 Years
Discussion Span
Last Post by HunainHafeez
1

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.