Hi I have webservice in asmx file:
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
[System.Web.Script.Services.ScriptService]
public class Trip : System.Web.Services.WebService
{
[WebMethod]
public String CopyTrip(String tripguid, String userguid)
{
return LibDataAccess.DBServices.Trip.CopyTrip(new Guid(userguid), new Guid(tripguid)).ToString();
}
[WebMethod(EnableSession=true)]
public Boolean SerializeObject(string serialize)
{
String[] _serializeObject = serialize.Replace("[]=", "-").Split('&');
LibBLL.Types.Trip _currentTrip = LibBLL.Trip.getSessionObj();
for (int i = 0; i < _serializeObject.Length; i++)
{
LibBLL.Types.POI _p = _currentTrip.pois.Where(e => e.guid == new Guid(_serializeObject[i])).FirstOrDefault();
_p.order = i;
}
LibBLL.Trip.setSessionObj(_currentTrip);
return true;
}
}
and i calls the method as follows
function SerializeObject(serialize) { var _url = baseUrl + "WebServices/Trip.asmx/SerializeObject"; //var _url = baseUrl + "moje_plany.aspx/SerializeObject"; $.ajax({ type: "POST", url: _url, data: "{'serialize': '" + serialize + "'}", contentType: "application/json; charset=utf-8", dataType: "json", success: function(msg) { alert(msg.d); }, error: function(msg) { alert(msg.d); } }); }
Method was run, but when i want to do something in session causses error
regards