Solved

Null object

Posted on 2011-03-11
7
377 Views
Last Modified: 2013-12-17

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





0
Comment
Question by:akohan
7 Comments
 
LVL 23

Expert Comment

by:wdosanjos
ID: 35111022
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
 
LVL 7

Expert Comment

by:jdavistx
ID: 35111029
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
 

Author Comment

by:akohan
ID: 35111080

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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
LVL 23

Accepted Solution

by:
wdosanjos earned 500 total points
ID: 35111136
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
 

Author Comment

by:akohan
ID: 35111225

Yes, I do have SSL.
0
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 35121528
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
 

Author Closing Comment

by:akohan
ID: 35151040
Thanks
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

823 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question