Solved

Null object

Posted on 2011-03-11
7
381 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project (http://www.eclipse.org/sequoyah/) automates most of the tasks discussed in this article. You can even fin…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

632 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