.net-core

How to I make a cURL command call from .Net Core 3.1 Code

爱⌒轻易说出口 提交于 2021-01-29 14:44:07
问题 I have this complicated cURL command that is working perfectly : curl -L --negotiate -u : -b ~/cookiejar.txt "https://idp.domain.net/oauth2/authorize? scope=openid&response_type=code&redirect_uri=https://localhost:5001&client_id=client_id_here" However it is not really feasible to replicate in C# using HttpClient. But I need to call the cURL command from .Net Core code and get the response back. Is there a way to make a normal cURL command call in .Net Core (v3.1)? (In case you are interested

.net Core 3.1 error 404 adding background-image in css

匆匆过客 提交于 2021-01-29 14:30:27
问题 Imagem Erro I am getting error 404 (in console) when adding background-image: url("/wwwroot/images/bg-01.jpg"); What i did was to remake the login page with a template, and it's all working. But cant add image to background. I have a template with pure css and html and js in notepad that is working.only when passing to .net core. the image is with error. In view i am not using _Layout The path is correct since i tested touse in a img tag with href:/wwwroot/images/bg-01.jpg and it works fine.

Generating c# files from .proto files using protoc on pre build event in VS 2017

喜夏-厌秋 提交于 2021-01-29 13:35:26
问题 I tried to generate c# files from .proto files using protoc from google.protobuf.tools nuget package on pre build event in Visual Studio 2017 for all .proto files in particular folder. I created .net core library project with .proto files. Pre-build event command line for for that protoc -I=$(ProjectDir)Messages --csharp_out=$(ProjectDir)Messages $(ProjectDir)*.proto where protoc is environment variable for precompiled version of protoc.exe But I got error error MSB3073: The command "protoc

Manual decode a Bearer Token using Azure Active Directory, How do I validate?

此生再无相见时 提交于 2021-01-29 13:00:52
问题 I'm using the code below in a Net Core WebApi app and it's working well. I can decode the JWT that it produces, but I would also like to verify it's signature. But, where do I get the key to verify it with? tenant = Configuration.GetSection("AzureAD:Tenant").Value; Logger.AppLogDebug("tenat value found: [{0}]", tenant); azureAdInstance = Configuration.GetSection("AzureAD:AzureADInstance").Value; Logger.AppLogDebug("azureAdInstance value found: [{0}]", azureAdInstance); audience =

Filter SQL GROUP by a filter that is not in GROUP

北战南征 提交于 2021-01-29 12:39:21
问题 Im working on a stream service like app based on C# NET.Core. Im "pinging" the server from client every minute and then create a new SQL entry with time and ID of this viewer. Here is a example of 5 minutes of view: StreamViewerId | TrackDate 1 | 2020-09-25 05:05:00 1 | 2020-09-25 05:06:00 1 | 2020-09-25 05:07:00 1 | 2020-09-25 05:08:00 1 | 2020-09-25 05:09:00 1 | 2020-09-25 05:10:00 ... I need to make a "chart bars" based on that data and i cant make the graphic with 1 minute as xAxis, so i

How to use Graph Explorer SDK?

做~自己de王妃 提交于 2021-01-29 12:35:31
问题 public class GraphService { public async Task<dynamic> CreateGraphClient() { string clientId = ""; string tenantID = ""; string redirectUri = "http://localhost"; //string clientSecret = ""; string email = "myemail"; SecureString password = new NetworkCredential("", "mypass").SecurePassword; string[] scopes = { "https://graph.microsoft.com/User.Read" }; IPublicClientApplication publicClientApplication = PublicClientApplicationBuilder .Create(clientId ) .WithTenantId(tenantID) .Build();

Angular and dotnetcore connection in Kubernetes throw 404

孤街浪徒 提交于 2021-01-29 11:29:54
问题 I struggle several days with that, and I can't find any solution. These are my files: Deployments: database: apiVersion: apps/v1 kind: Deployment metadata: name: dbdeployment labels: app: dbdemployment spec: selector: matchLabels: app: dbdeployment replicas: 1 template: metadata: name: dbdeployment labels: app: dbdeployment spec: containers: - name: dbcontainer image: docker.io/library/sc_db:cluster imagePullPolicy: Never ports: - containerPort: 5432 backend: apiVersion: apps/v1 kind:

Get MainWindowHandle of spawned process in .NET Core

不羁的心 提交于 2021-01-29 11:25:12
问题 I have this code: private static void Start(String path) { var process = Process.Start(new ProcessStartInfo(path) { WindowStyle = ProcessWindowStyle.Maximized, UseShellExecute = true, }); ThreadPool.QueueUserWorkItem(Tick, process); } private static void Tick(Object obj) { var process = (Process) obj; while (true) { Debug.WriteLine($"HWND: {process.MainWindowHandle}"); Thread.Sleep(TimeSpan.FromMilliseconds(10)); } } This starts a process and then displays the MainWindowHandle property every

How can register profiles in Automapper from different assemblies?

…衆ロ難τιáo~ 提交于 2021-01-29 11:21:14
问题 I have an application (NET Core) with many assemblies: WebAPI (contain view models and consume DTO) Services (contain DTO and consume Domain entities) On WebAPI assembly I registered automapper profiles automatically with this line: services.AddAutoMapper(); With this line I can convert view models to DTO (and backwards) But I need register profiles located on Services layer to convert DTO to Domain entities (and backwards) Evidently, Automapper not found this profiles. What's the best way to

Create database context from cookie and base path in Entity Framework Core

流过昼夜 提交于 2021-01-29 11:16:54
问题 Postgres database has multiple schemes like company1, company2, ... companyN Browser sends cookie containing scheme name . Data access operations should occur in this scheme. Web application user can select different scheme. In this case different cookie value is set. Npgsql EF Core Data provider is used. ASP NET MVC 5 Core application registers factory in StartUp.cs : public void ConfigureServices(IServiceCollection services) { services.AddHttpContextAccessor(); services.AddScoped