[ServiceContract(Namespace = "http://ExpertsExchange.Answers.ServiceContracts/2009/02", Name = "OrderService", SessionMode = SessionMode.Allowed)] public interface IService1 { [OperationContract] void SetSession(string value); [OperationContract] String GetSession(); }
[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single)] [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)] public class Service1 : IService1 { public void SetSession(string value) { HttpContext.Current.Session["Test"] = value; } public string GetSession() { string value = Convert.ToString(HttpContext.Current.Session["Test"]); return value; } }
protected void Page_Load(object sender, EventArgs e) { ServiceReference1.OrderServiceClient obj = new OrderServiceClient(); obj.SetSession("Susheel"); String Sessionvalue = obj.GetSession(); }
An error occurred while receiving the HTTP response to http://localhost:1908/Service1.svc. This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details.
<system.web> <httpRuntime maxRequestLength="32768" /> </system.web>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)