How do we handle session in Aspn.Net boiler plate? My question is, I need to implement a logout user feature. How to I unauthorize a user, or in other hand, how do I reset the session?
I have a web api, not a dynamic web api. A user login by providing the credentials to the api, and in response gets a token, which is passed back to the other methods in the api controller along with other requests. I have a logout feature - if a user clicks the logout button, I need to logout that particular user, disable that session and token.
How to implement HostAuthenticationFilter("Bearer") in Api controllers inherited from AbpApiController like the following that we do for dynamic api ?
Configuration.Modules.AbpWebApi().HttpConfiguration.Filters.Add(new HostAuthenticationFilter("Bearer"));
I am trying to pass custom Http Status codes in the response headers, when using Asp.Net boiler plate Dynamic API and web api written by inheriting AbpApiController.
The following are the two ways I tried, but failed: a) In the AppService, I used
public async Task<HttpResponseMessage> GetData()
{
HttpResponseMessage response=new HttpResponseMessage();
response.Headers.Add("Status", "201");
return response;
}
b) My another approach was to write an ApiController which inherited AbpApiController. And in that, I wrote
public IHttpActionResult GetData()
{
var data=null;
return NotFoundResult(data);
}
Both of these approaches failed. How do we implement this?
Thanks in advance :-)