Solved

Null object

Posted on 2011-03-11
7
375 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
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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 74

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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

746 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now