0

i'm currently developing a new application for a customer, and i got stuck with a request from the user.

the application is a simple web with bootstrap, the application show a couple of pages and uses webapi to perform the data interaction with the server. so far so good.

the client is asking me to create a way to save the search that the user perform for the entire session. So if the client in the current session does browse the same page, the search is reloaded to the page.

what i thought was to serialize the search when it hits the webapi in session or it would be great to save it in tempdata.

but i know that webapi is session less, and i can activate that with this:

protected void Application_PostAuthorizeRequest()
{
   if (IsWebApiRequest())
   {
      HttpContext.Current.SetSessionStateBehavior(SessionStateBehavior.Required);
   }
}

But what i want is someone to point me which is the best way to accomplish this.

Any advice will be appreciated.

Regards

Rothariger
  • 293
  • 3
  • 22

1 Answers1

0

I know this is an old post but what I have noticed is that even though the session ID is returned for the WEB API, it is different for each request. Do you perhaps know a way in which you can make the WEB API session ID be consistent for. I have an application which had BOTH MVC and WEB API. In MVC the session ID is consistent but in WEB API it's not.