asp.net-core-2.0

Can't bind params using [FromQuery] ASP Net Core 2 API

青春壹個敷衍的年華 提交于 2021-01-27 18:36:14
问题 I'm new in ASP Net Core 2, I want to bind different parameters that come from URL query string to action parameters in my action: [HttpGet("{page}&{pageSize}&{predicate}", Name = "GetBuildingsBySearchCriteria")] public IActionResult GetBuildingsBySearchCriteria([FromHeader] string idUser, [FromQuery]int page, [FromQuery]int pageSize, [FromQuery]string predicate) { .... } When I test my action using postman, I set the idUser in header and other parameters in URL, example: http://localhost

Video File streaming not working on Safari/ iOS device in asp.NET Core 2.0

情到浓时终转凉″ 提交于 2021-01-27 17:35:43
问题 I have created the API in asp.net core 2.0 that returns the video file streaming Result. Below is the code sample for returning the filestream result. The URL is working fine on Chrome but the URL will not work on iOS device and Safari browser. How to implement the range request / response in asp.net core 2.0? var fileStream = await this.amazonS3Service.Open( request.FileName, path, cancellationToken); return new FileStreamResult(fileStream, this.GetContentType(request.FileName)); 回答1: What

ASP.Net Core 2 how to trigger/call code after authentication

若如初见. 提交于 2021-01-27 13:44:29
问题 How can I trigger some code right after authentication? Let's say I want to give my application a single session constraint per user, for example. How can I implement it in ASP.Net Core 2.0? Update: Clarification, I want to trigger code right after a user is considered authenticated (after .net authentication middleware have validated the user is who claims to be). I have not mentioned Middleware before because there might be an easier way, like an event, to trigger some code. Maybe the

What is BearerOption.SaveToken property used for?

安稳与你 提交于 2021-01-27 06:18:33
问题 What bearerOption.SaveToken property used for in the configuration of JwtAuthentication in aspnet core 2 ? services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme) .AddJwtBearer(bearer => { bearer.TokenValidationParameters.IssuerSigningKey = signingKey as SecurityKey; bearer.TokenValidationParameters.ValidIssuer = Configuration["Jwt:Issuer"]; bearer.TokenValidationParameters.ValidAudience = Configuration["Jwt:Audience"]; bearer.TokenValidationParameters.ClockSkew = TimeSpan.Zero;

Restart needed after installing .NET Core Runtime and SDK?

风流意气都作罢 提交于 2021-01-27 05:07:24
问题 We're about to deploy a netcore 2.0 application on production, but we need to install .NET Core Runtime and SDK first. Is a restart needed for the installation to take effect? Since it's production, we don't want that to happen. 回答1: We installed the following from here x64 Installer (SDK) x64 Installer (Runtime) Windows Server Hosting (Runtime) There was no need to restart the machine and nothing blew up (: 回答2: You could just install Windows Server Hosting Bundle without SDK on your

String Trim Model Binder in ASP .NET Core 2

若如初见. 提交于 2021-01-23 20:23:49
问题 I'm working on a .NET Core 2 API project and have been trying to implement a universal string trim model binder that would trim all string values of provided request parameters and field values. So far I have had mixed results and am struggling to find working example that would point me in the right direction. I've been trying to implement the same model binder as posted by Vikash Kumar. This model binder works fine for all string values that are passed into controller actions via direct

String Trim Model Binder in ASP .NET Core 2

[亡魂溺海] 提交于 2021-01-23 20:23:20
问题 I'm working on a .NET Core 2 API project and have been trying to implement a universal string trim model binder that would trim all string values of provided request parameters and field values. So far I have had mixed results and am struggling to find working example that would point me in the right direction. I've been trying to implement the same model binder as posted by Vikash Kumar. This model binder works fine for all string values that are passed into controller actions via direct

String Trim Model Binder in ASP .NET Core 2

不打扰是莪最后的温柔 提交于 2021-01-23 20:21:53
问题 I'm working on a .NET Core 2 API project and have been trying to implement a universal string trim model binder that would trim all string values of provided request parameters and field values. So far I have had mixed results and am struggling to find working example that would point me in the right direction. I've been trying to implement the same model binder as posted by Vikash Kumar. This model binder works fine for all string values that are passed into controller actions via direct

String Trim Model Binder in ASP .NET Core 2

大憨熊 提交于 2021-01-23 20:21:47
问题 I'm working on a .NET Core 2 API project and have been trying to implement a universal string trim model binder that would trim all string values of provided request parameters and field values. So far I have had mixed results and am struggling to find working example that would point me in the right direction. I've been trying to implement the same model binder as posted by Vikash Kumar. This model binder works fine for all string values that are passed into controller actions via direct

String Trim Model Binder in ASP .NET Core 2

江枫思渺然 提交于 2021-01-23 20:19:28
问题 I'm working on a .NET Core 2 API project and have been trying to implement a universal string trim model binder that would trim all string values of provided request parameters and field values. So far I have had mixed results and am struggling to find working example that would point me in the right direction. I've been trying to implement the same model binder as posted by Vikash Kumar. This model binder works fine for all string values that are passed into controller actions via direct