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
Post a Comment