Link to home
Start Free TrialLog in
Avatar of akohan
akohan

asked on

Null object


Hi,

I'm developing a web application, where it has few stages to process an order. There is an object as paymentInfo from PaymentInfo class (in step 3) and I need to use it in step 4. How can I access paymentInfo object from the last phase (step 4)?

The problem is that when I declare an object such as:

PaymentInfo myobj = new PaymentInfo();

I see myobj has null value.

Any help is appreciated.

Regards,
ak





Avatar of wdosanjos
wdosanjos
Flag of United States of America image

You should save the PaymentInfo object in the Session.  Something like this:

On Step 1:
PaymentInfo myobj = new PaymentInfo();
Session["PaymentInfo"] = myobj;

On the following steps:
PaymentInfo myobj = (PaymentInfo)Session["PaymentInfo"];


More info on Session:
http://msdn.microsoft.com/en-us/library/ms178581.aspx

I hope this helps.
Avatar of jdavistx
jdavistx

Not sure how your stages are setup, but it looks like you need to pass your object to the next phase.  You need to send myObj to the next phase using whatever mechanism starts phase 4.  Your myObj is null because you're initializing a brand new PaymentInfo object.
Avatar of akohan

ASKER


that is right but temporary I need to pass credit card info and saving it into session is not a safe way. Any comments on this?

Thanks.
ASKER CERTIFIED SOLUTION
Avatar of wdosanjos
wdosanjos
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of akohan

ASKER


Yes, I do have SSL.
Avatar of kaufmed
Do keep in mind, though, that whatever you decide to store in session, every user will have their own session. If you plan to store large objects, saving them to a DB may be a more logical choice.
Avatar of akohan

ASKER

Thanks