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

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -