c# - Is it possible to pass a Session variable (object) to an API as a parameter? -
i have web page search criteria.
once user selects wants , inputs keywords search, re-directed page shows results of search.
this session object contains of information of search:
var projectsearchcriteria = (gblprojectsearchcriteria) session[gblconstants.session_project_search_criteria];
is there way me pass object api?
like so:
[httpget] public list<string> getepisodes(gblprojectsearchcriteria psc) { var projectsearchresult = new projectsearchresultcontroller(); var gblprojectsearchresultlistdata = projectsearchresult.getprojectsearchresultlist(psc); return (from gblprojectsearchresult item in gblprojectsearchresultlistdata select item.title).tolist(); }
the reason why want because search criteria massive , exists don't want api have 38032823 parameters.
is possible? how it? alternatives?
web api binds parameters either uri, query string, etc. or request body. if want bind thing else, outside of request message, can create own parameter binding. see this. blog post creates parameter binding type iprincipal
can similar `gblprojectsearchcriteria'.
Comments
Post a Comment