asp.net-web-api2

Simplest way to add Basic authentication to web.config with user/pass

陌路散爱 提交于 2020-12-25 03:50:10
问题 I'm setting up an Azure API Management with with an ASP.NET WebApi 2 app behind it. API Management recommends setting up Basic auth between the API Management proxy and the ASP.NET WebApi to make sure the WebApi is only accessible through the API Management proxy. (Of course OAuth tokens will be still sent with requests for the "real" authentication, but I'll add that later.) With this in mind, I don't really want to implement the Basic auth in the application, I would like to have it handled

Object null in WebApi method after PostAsJsonAsync

寵の児 提交于 2020-12-14 06:54:45
问题 I am posting an object to a WebApi method. I'm using PostAsJsonAsync to do this. public async Task<HttpResponseMessage> PostAsync(string token, ServiceCall call) { var client = new HttpClient(); client.SetBearerToken(token); var response = await client.PostAsJsonAsync(Uri + "id/nestedcall", call); return response; } The object call that I'm passing is not null when I post it. [HttpPost] [Route("id/nestedcall")] public async Task<IHttpActionResult> NestedCall([FromBody]ServiceCall call) { //

Object null in WebApi method after PostAsJsonAsync

◇◆丶佛笑我妖孽 提交于 2020-12-14 06:52:04
问题 I am posting an object to a WebApi method. I'm using PostAsJsonAsync to do this. public async Task<HttpResponseMessage> PostAsync(string token, ServiceCall call) { var client = new HttpClient(); client.SetBearerToken(token); var response = await client.PostAsJsonAsync(Uri + "id/nestedcall", call); return response; } The object call that I'm passing is not null when I post it. [HttpPost] [Route("id/nestedcall")] public async Task<IHttpActionResult> NestedCall([FromBody]ServiceCall call) { //

Generate Reset Password link in WebApi

爷,独闯天下 提交于 2020-12-08 05:29:21
问题 I wanted to generate a reset password link to send to the user's email that will open the ResetPassword page. On this page I will fill in the details regarding the new password and then confirm the password. For this I have followed this Link But there is a Url.Action method that i am not able to find in my web api project. var callbackUrl = Url.Action( "ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme); Hase anybody done the reset password part in

proper implementation of “windows” authentication in web api?

雨燕双飞 提交于 2020-11-30 06:38:11
问题 I've created a Web Api 2 app which will only be used on the corporate network. I've read about Windows authentication in Web API so it seems to be possible. But I need to figure out the proper implementation for this. I've included the following xml in my Web.config: <system.web> <authentication mode="Windows" /> </system.web> I seem to remember some type of event hook in old school webforms app. Something like BeginRequest() where a security check could be made before rendering a page. I