38 Questions

beginer
beginer
216 Points
63 Posts
How to get Hours and Minutes as two digits with leading zero from DateTime object? I'm trying following code formulate the file path: var filePath = $"{DateTime.UtcNow.Year}/{DateTime.UtcNow.Month}/{DateTime.UtcNow.Day}/{DateTime.UtcNow.Hour}/{DateTime.UtcNow.Minute}/{Guid.NewGuid()}"; But it' ...
Views: 37
Total Answered: 1
Total Marked As Answer: 0
Posted On: 07-Apr-2021 06:00 
 
beginer
beginer
216 Points
63 Posts
I'm trying following code to scaling image: public static Image ScaleImage(Image image, int maxWidth, int maxHeight) { var ratioX = (double)maxWidth / image.Width; var ratioY = (double)maxHeight / image.Height; var ratio = Math.Min(ratioX, ratioY); var newWidth = (int)(image.Width * rat ...
Views: 80
Total Answered: 1
Total Marked As Answer: 1
Posted On: 16-Mar-2021 08:13 
 
beginer
beginer
216 Points
63 Posts
I have .net core api application when running on IIS or Kestrel Server getting correct locale and culture. But when running on Linux container it's coming blank causing DateTime.Now.ToString("t") showing incorrect format. Using docker command as: FROM mcr.microsoft.com/dotnet/core/aspnet:3.1 ...
Views: 113
Total Answered: 1
Total Marked As Answer: 1
Posted On: 08-Feb-2021 06:09 
 
beginer
beginer
216 Points
63 Posts
I'm trying to build docker image and even any docker command, getting following error: error during connect: This error may indicate that the docker daemon is not running. : Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.24/containers/json : open //./pipe/docker_engine: The system cannot find the ...
Views: 250
Total Answered: 2
Total Marked As Answer: 1
Posted On: 01-Feb-2021 02:18 
 
Smith
Smith
Participant
584 Points
137 Posts
I'm using docker-desktop to build containerized image. Build getting failed at restore command in docker file. It's not able to download any package. It's happening in local build.
Views: 78
Total Answered: 1
Total Marked As Answer: 0
Posted On: 28-Jan-2021 06:18 
 
edx
edx
90 Points
30 Posts
I'm using WebRequest to consume/integrate REST api in .netcore project something like: WebRequest request = WebRequest.Create(url); request.Method = "POST"; request.Credentials = MyCredentialCache; try { WebResponse response = await request.GetResponseAsync(); } catch { } It's w ...
Views: 242
Total Answered: 1
Total Marked As Answer: 1
Posted On: 26-Oct-2020 00:36 
 
Jak
Jak
Member
392 Points
161 Posts
I'm using nlog with .netcore REST Api as: using Microsoft.Extensions.Logging; } catch (Exception ex) { Logger.LogCritical(-1, ex, string.Format("error occurred: {0}", ex.Message)); } But getting error as: An error occurred while writing to logger(s). (Input string was not in a cor ...
Views: 547
Total Answered: 1
Total Marked As Answer: 0
Posted On: 30-Sep-2020 03:26 
 
edx
edx
90 Points
30 Posts
I have two collections User { "_id" : ObjectId("5f51dac5ea43442fa419ca1f"), "name" : "John b" } Role { "_id" : ObjectId("584aaca6686860d502929b8d"), "role" : "Admin", "userId" : "5f51dac5ea43442fa419ca1f" } I want to join two collection based on the userId (in role collect ...
Views: 1591
Total Answered: 2
Total Marked As Answer: 1
Posted On: 11-Sep-2020 05:35 
 
beginer
beginer
216 Points
63 Posts
Is there any way to parse or decode the bearer token i.e. jwt access token in c#. I want to get all claims in the token. I don't want to authenticate it but to get claims.
Views: 408
Total Answered: 1
Total Marked As Answer: 1
Posted On: 14-Aug-2020 05:52 
 
beginer
beginer
216 Points
63 Posts
I'm try to serialise an C# object to json by using Newtonsoft.Json.Serialization but it's returning name of properties as Pascal-case. For an example consider the following C# class: public class Person { public string FirstName { get; set; } public string LastName { get; set; } } ...
Views: 487
Total Answered: 1
Total Marked As Answer: 0
Posted On: 09-Jul-2020 00:07 
 
 Log In to Chat