Thursday, March 22, 2012

Web Service State Management Issue

ok here is my small problem. the lines below are written in WebMethod and works fine. What I need to do is t o move the lines written in Bold to the class library since It does not look good lying in the WebMethod.
I need to maintain the amount variable so that it contains the sum of all the amount on which the customer is than validated. Any ideas on this:



amount += Convert.ToInt64(Session["Charge"]);

Session["Charge"] = amount;

if(!(service.ValidateData(cardNumber,firstName,lastName,expireDate,amount)))

{

throw new ApplicationException();

}

Make sure you have:
using System.Web;
in your class file, and then you should be able to access Session in formation by using:
HttpContext.Current.Session["Charge"]
HTH...

Chris
Thanks a ton man :D

0 comments:

Post a Comment