1,105,371 Community Members

session lost

Member Avatar
HunainHafeez
Posting Whiz
340 posts since Aug 2012
Reputation Points: 9 [?]
Q&As Helped to Solve: 4 [?]
Skill Endorsements: 2 [?]
 
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();
                }
        }
    }
}
Member Avatar
JorgeM
IT Addict
6,387 posts since Dec 2011
Reputation Points: 567 [?]
Q&As Helped to Solve: 956 [?]
Skill Endorsements: 172 [?]
Moderator
Featured
Sponsor
 
1
 

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

Member Avatar
HunainHafeez
Posting Whiz
340 posts since Aug 2012
Reputation Points: 9 [?]
Q&As Helped to Solve: 4 [?]
Skill Endorsements: 2 [?]
 
0
 

jorgem i tried these but non of these helped :(

Member Avatar
JorgeM
IT Addict
6,387 posts since Dec 2011
Reputation Points: 567 [?]
Q&As Helped to Solve: 956 [?]
Skill Endorsements: 172 [?]
Moderator
Featured
Sponsor
 
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.

Member Avatar
HunainHafeez
Posting Whiz
340 posts since Aug 2012
Reputation Points: 9 [?]
Q&As Helped to Solve: 4 [?]
Skill Endorsements: 2 [?]
 
0
 

ok jorgem thanks alot , u helped alot

but still no progress , i tried my best :(

You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: