c# - Session variable is reset after making a request to Web API controller -
i'm using session in web api implementing follow answer enable session in web api 2. got problem session variables.
in business object class, have property used store changed record.
public class basebo { protected httpsessionstate _session; public basebo() { _session = httpcontext.current.session; } private ilist<fundinvestor> _investors; public ilist<fundinvestor> investors { { _investors = (ilist<fundinvestor>)_session["_investors"]; if (_investors == null) { _investors = new list<fundinvestor>(); _session["_investors"] = _investors; } return _investors; } set { _investors = value; _session["_investors"] = value; } } }
at client, when saving form, make 2 requests server. first, call method addinvestorqueue
of basebo instance list of changed records. changed records added list investors
of basebo
. second request, call method edit
in element of list investor
, update these records database.
my problem list investors
doesn't have element when call second request. note there records added investors
in first request. don't know why list reset.
this issue doesn't occurs when use asp.net web form.
is there met similar issue? stuck issue. advice helpful me. thank much.
Comments
Post a Comment