c# - Creating cookie when using odata and web api 2 -


how set cookie when using web api 2 , odata. new api , traditionally used context.response not seem avaliable here.

this part of controller code:

public async task<ihttpactionresult> post(order order) {     if (!modelstate.isvalid)     {         return badrequest(modelstate);     }      context.orders.add(order);     await context.savechangesasync();      return created(order); } 

you can write own delegatinghandler add cookie need response.

check part "example: set , retrieve cookies in message handler":

http://www.asp.net/web-api/overview/working-with-http/http-cookies

for how insert message handler, check this:"per-route message handlers"

http://www.asp.net/web-api/overview/working-with-http/http-message-handlers


Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -