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





akohanAsked:
Who is Participating?
 
wdosanjosConnect With a Mentor Commented:
Session state is kept on the server memory by default.  Assuming you are using SSL, why do you think that's unsafe?   You can always encrypt the information in memory, if memory access is a concern.

More on Securing Session State:
http://msdn.microsoft.com/en-us/library/ms178201.aspx
0
 
wdosanjosCommented:
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.
0
 
jdavistxCommented:
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.
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
akohanAuthor Commented:

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.
0
 
akohanAuthor Commented:

Yes, I do have SSL.
0
 
käµfm³d 👽Commented:
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.
0
 
akohanAuthor Commented:
Thanks
0
All Courses

From novice to tech pro — start learning today.