We are integrating payment gateway in our application. Issue what we are facing is that after supplying variables to payment gateway ,on the t开发者_如何学Carget page we are unable to fetch all that session values after data processed through different pages. Which will be the best technique to maintain control value from source page through different pages to target page.
I have though of maintaining it in temporary table but it will make process complicated.
Please suggest some better option.
Thanks in advance. Anand
Use Cookies and delete it once you get the information after payment geteway.
You should probably store this in a sessions, asp.net has 3 methods of session management built in, they are database, state-server or local memory.
You could store you data in the session like so
Session["myKey"] = "myValue";
and later get it out using Session["myKey"];
The data would exist in the session for as long as you set the session timeout to be (by default I think it is 20 minutes)
I would suggest either database or state-server as these options work in web-farm scenarios whereas in-memory would not (at least without having some smart load balancer that always redirects the client back to the server their original request came form).
Using cookies is also an option but depending on your security requirements it may be unacceptable as cookies can be viewed by the user and possibly altered, although you can mitigate this with encryption and hashing of the cookie.
Create a Order object that contains all you need. And then pass this Order object along a session to each page where you add stuff and in your final page you save the object to DB or what ever you whant to do with it
This will depend upon the nature of data that you wish to maintain. If data-loss is acceptable then you can push this data into the session. It will be simplest mechanism - however, the data will be lost on server restarts (or in case of web farm) in case of in-process session storage. You can choose out of process session storage (database or sql) but it means that your entire session data will be persisted in another medium. Also data can still be lost if session has timed out.
Alternately, you can persist the data into database (or another persistent medium) - it will be de-linked from ASP.NET session and you get a lot of flexibility. On flip side, you have to write code to persist the data into DB (using ORM such as EF or NHibernate may save time). Personally, I would go to this route only if the data is critical and must survive a session re-start (i.e. user can logs out of site and resumes/reviews the transaction on next login. For example, order details or persistent shopping carts etc).
精彩评论