asp.net-core-2.0

Disable/Remove '?ReturnUrl=' from Url's in netcore 2

只愿长相守 提交于 2021-02-19 01:41:32
问题 I am trying to find a way to prevent my aspnetcore application to add "?ReturnUrl=" to the URL. Does anyone know how to do it, using some kind of middleware. I tried doing it like below but it did not have any effect: public class RequestHandlerMiddleware { private readonly RequestDelegate _next; public RequestHandlerMiddleware(RequestDelegate next) { _next = next; } public async Task Invoke(HttpContext context) { if(context.Request.QueryString.HasValue && context.Request.QueryString.Value

SignalR - Call statically typed hub from Context

ε祈祈猫儿з 提交于 2021-02-19 01:37:32
问题 I'm trying to figure out how to invoke a method on a strongly typed hub from the server. I'm using .Net-Core 2.0 I have a stongly typed hub interface: public interface IMessageHub { Task Create(Message message); } and a hub which looks like so: public class MessageHub: Hub<IMessageHub> { public async Task Create(Message message) { await Clients.All.Create(message); } } Normally on the server I might push content to the client like so: [Route("api/[controller]")] public MessagesController :

SignalR - Call statically typed hub from Context

落花浮王杯 提交于 2021-02-19 01:37:05
问题 I'm trying to figure out how to invoke a method on a strongly typed hub from the server. I'm using .Net-Core 2.0 I have a stongly typed hub interface: public interface IMessageHub { Task Create(Message message); } and a hub which looks like so: public class MessageHub: Hub<IMessageHub> { public async Task Create(Message message) { await Clients.All.Create(message); } } Normally on the server I might push content to the client like so: [Route("api/[controller]")] public MessagesController :

ASP.NET Core JWT/Windows Authentication HTTP 400 Error

落花浮王杯 提交于 2021-02-18 18:52:09
问题 I have an ASP.NET Core 2.1 Web API which currently requires users to enter a username/password to recieve a JWT for authorization. I want to add the option of using Windows Authentication to recieve a JWT as well. Ultimately, I plan to have two authorization controllers, one for username/password, the other for Windows Auth. To test this, I first enabled Windows Authentication in IIS express, by right clicking on my project and going to Properties. Then, I made a simple test controller to see

Azure AD B2C - how to implement custom sign up process?

泄露秘密 提交于 2021-02-18 18:48:39
问题 This is basically a follow up to my prev question - https://stackoverflow.com/a/44738654/2896495. I've implemented an Azure B2C sign up and auth in my web app (.NET Core 2.0) and now I want to add a custom sign up logic with Graph API (as described here - https://docs.microsoft.com/en-us/azure/active-directory-b2c/active-directory-b2c-devquickstarts-graph-dotnet). But I'm confused about app registrations. For B2C auth I created an app in the Portal under Azure AD B2C -> Applications. Now, in

Does .NET Core 2.0 have SFTP client? [closed]

本小妞迷上赌 提交于 2021-02-18 10:14:45
问题 Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 2 years ago . Improve this question Needing to use an SFTP client and looking to build it in a .NET Core 2.0 application. I was wondering if SFTP is already part of .NET standard 2.0 or will I need to use a 3rd party library for this, e.g. SSH.NET? 回答1: There's no SFTP client in any current version

Does .NET Core 2.0 have SFTP client? [closed]

我们两清 提交于 2021-02-18 10:14:38
问题 Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 2 years ago . Improve this question Needing to use an SFTP client and looking to build it in a .NET Core 2.0 application. I was wondering if SFTP is already part of .NET standard 2.0 or will I need to use a 3rd party library for this, e.g. SSH.NET? 回答1: There's no SFTP client in any current version

The Same Origin Policy disallows reading the remote resource

大兔子大兔子 提交于 2021-02-18 08:07:49
问题 I am getting a problem with possibly Cors. I am doing local dev(react frontend, asp.net core 2 api backend). Both IE 11 and Chrome have no problem, but Firefox has a problem with my requests. I just keep getting "Network Error" from my calls. I disabled "HSTS" in firefox and now I am seeing a "warning message" Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://localhost:44391/api/tokens/auth. (Reason: CORS request did not succeed). In my cor

415 Unsupported Media Type asp.net core

假如想象 提交于 2021-02-16 15:48:27
问题 Detail I am trying to post a file from Postman to the endpoint I have created. but it gives me this error. I am not passing the header Content-Type in postman 415 Unsupported Media Type API [Consumes("multipart/form-data")] [HttpPost] public async Task<IActionResult> SendEmail([FromBody]Entity entity) { try { return OK(); } catch (Exception e) { throw e; } } Class public class Entity { public List<IFormFile> Files { get; set; } } 回答1: Try using [FromForm] instead of [FromBody] for the method

415 Unsupported Media Type asp.net core

混江龙づ霸主 提交于 2021-02-16 15:48:08
问题 Detail I am trying to post a file from Postman to the endpoint I have created. but it gives me this error. I am not passing the header Content-Type in postman 415 Unsupported Media Type API [Consumes("multipart/form-data")] [HttpPost] public async Task<IActionResult> SendEmail([FromBody]Entity entity) { try { return OK(); } catch (Exception e) { throw e; } } Class public class Entity { public List<IFormFile> Files { get; set; } } 回答1: Try using [FromForm] instead of [FromBody] for the method