asp.net-core-2.0

Bearer error=“invalid_token”, error_description=“The signature is invalid”

徘徊边缘 提交于 2020-12-30 05:55:10
问题 I have a angular application that request a token from azure. The login went well and I get a token. This token is now send from the angular app to a net core webapi application. Net core should verify this token but failed. I think the webapi should also contact azure to validate the token because it has no knowledge of the private and public key that is needed to verify the token. At the moment it is not clear why it is failing. Both angular app and the webapi are running local on my

ASP.NET Core 2 - Missing content-type boundary

假装没事ソ 提交于 2020-12-25 08:39:22
问题 I'm trying to upload a file from a Angular client to my ASP.NET Core 2 WebAPI service. When I call the service, I get back an Internal Server Error. That's the error I'm getting: The component I'm using client-side is this one: ngx-uploader In my request options, i set them as you can see here: const event: UploadInput = { type: 'uploadAll', url: this.printService.apiFilesBaseUrl + '/Upload', method: 'POST', file: this.files[0], headers: { 'Content-Type': 'multipart/form-data', 'Accept': '*/*

ASP.NET Core 2 - Missing content-type boundary

拜拜、爱过 提交于 2020-12-25 08:29:47
问题 I'm trying to upload a file from a Angular client to my ASP.NET Core 2 WebAPI service. When I call the service, I get back an Internal Server Error. That's the error I'm getting: The component I'm using client-side is this one: ngx-uploader In my request options, i set them as you can see here: const event: UploadInput = { type: 'uploadAll', url: this.printService.apiFilesBaseUrl + '/Upload', method: 'POST', file: this.files[0], headers: { 'Content-Type': 'multipart/form-data', 'Accept': '*/*

Asp.net Core Persistent Authentication - Custom Cookie Authentication

爱⌒轻易说出口 提交于 2020-12-23 11:41:19
问题 I'm trying to get a persistent connection so the users only have to use their password once. I've used this doc: https://docs.microsoft.com/en-us/aspnet/core/security/authentication/cookie?tabs=aspnetcore2x but the users still get disconnected after a while. await HttpContext.SignInAsync( CookieAuthenticationDefaults.AuthenticationScheme, principal, new AuthenticationProperties { IsPersistent = true }); What can I do to get a really persistent connection ? 回答1: The persistence granted by

Asp.net Core Persistent Authentication - Custom Cookie Authentication

 ̄綄美尐妖づ 提交于 2020-12-23 11:39:32
问题 I'm trying to get a persistent connection so the users only have to use their password once. I've used this doc: https://docs.microsoft.com/en-us/aspnet/core/security/authentication/cookie?tabs=aspnetcore2x but the users still get disconnected after a while. await HttpContext.SignInAsync( CookieAuthenticationDefaults.AuthenticationScheme, principal, new AuthenticationProperties { IsPersistent = true }); What can I do to get a really persistent connection ? 回答1: The persistence granted by

How to use HostBuilder for WebJob?

二次信任 提交于 2020-12-08 05:42:30
问题 With .Net 2.0 was introduced the really usefull HostBuilder for Console App like we have with WebHostBuilder for Web Application. My concern is now how to implement the HostBuilder with WebJob with a QueueTrigger? Until now, I was using JobActivator: var startup = new Startup(); var serviceProvider = startup.ConfigureServices(new ServiceCollection()); startup.Configure(serviceProvider); var jobHostConfiguration = new JobHostConfiguration() { JobActivator = new JobActivator(serviceProvider), }

ASP.NET Core Script Tag Helper asp-fallback-src fails integrity check

旧巷老猫 提交于 2020-12-01 10:14:43
问题 I'm receiving the following error when I test falling back to a local file using the ASP.NET Core Script Tag Helper: Failed to find a valid digest in the 'integrity' attribute for resource 'http://localhost:48888/js/jquery.min.js' with computed SHA-256 integrity 'oozPintQUive6gzYPN7KIhwY/B+d8+5rPTxI1ZkgaFU='. The resource has been blocked. The local file is text equal to the CDN version, but is not binary equal. This becomes a problem because the integrity hash is compared against not only

Create text file and download without saving on server in ASP.net Core MVC 2.1

百般思念 提交于 2020-12-01 10:06:28
问题 I've found a way to create a text file then instantly download it in the browser without writing it to the server in regular ASP.net: Create text file and download The accepted answer uses: using (StreamWriter writer = new StreamWriter(Response.OutputStream, Encoding.UTF8)) { writer.Write("This is the content"); } I need to do this in ASP.net Core 2.1 MVC - though in that doesn't know what Response.OutputStream is - and I can't find anything on Google to help with that, or other ways to do

Create text file and download without saving on server in ASP.net Core MVC 2.1

[亡魂溺海] 提交于 2020-12-01 10:04:10
问题 I've found a way to create a text file then instantly download it in the browser without writing it to the server in regular ASP.net: Create text file and download The accepted answer uses: using (StreamWriter writer = new StreamWriter(Response.OutputStream, Encoding.UTF8)) { writer.Write("This is the content"); } I need to do this in ASP.net Core 2.1 MVC - though in that doesn't know what Response.OutputStream is - and I can't find anything on Google to help with that, or other ways to do

How to use TLS 1.2 in ASP.NET Core 2.0

时间秒杀一切 提交于 2020-11-27 04:04:47
问题 My salesforce res apis were working fine until. When suddenly I started getting authentication errors. retry your request. Salesforce.Common.AuthenticationClient.d__1.MoveNext() . salesforce informed that it would use from now TLS .1.2. How can I enforce my asp.net core 2.0 to use TLS 1.2 in Startup.cs. below is my code for login. private async Task<AuthenticationClient> GetValidateAuthentication() { RestApiSetting data = new RestApiSetting(Configuration); var auth = new AuthenticationClient(