30 Questions

beginer
beginer
154 Points
47 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: 25
Total Answered: 1
Total Marked As Answer: 0
Posted On: 14-Aug-2020 05:52 
 
beginer
beginer
154 Points
47 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: 91
Total Answered: 1
Total Marked As Answer: 0
Posted On: 09-Jul-2020 00:07 
 
beginer
beginer
154 Points
47 Posts
I want to serialize enums in the serialization object as string instead of numeric value. Not like this: }, "gender": 3, "birthDate": "1980-01-01", Like this: }, "gender": "Male", "birthDate": "1980-01-01", I'm using following: using Newtonsoft.Json.Serialization; // package JsonC ...
Views: 74
Total Answered: 1
Total Marked As Answer: 0
Posted On: 08-Jul-2020 23:52 
 
Jak
Jak
Member
388 Points
159 Posts
I'm getting issue with fetching records from collection with objectId as: { "_id" : ObjectId("5c92b80036de59bd9de0639d"), "UserName" : "John" } { "_id" : ObjectId("5c92b80436de59bd9de0639e"), "UserName" : "Chris" } { "_id" : ObjectId("5c92b80936de59bd9de0639f"), "UserName" : "Larry" } { "_id" : ...
Views: 159
Total Answered: 1
Total Marked As Answer: 1
Posted On: 30-Jun-2020 23:25 
 
edx
edx
66 Points
23 Posts
I'm using mongodb.driver in .net core project. In this using following method to insert and update collections: mongoDB.GetCollection("COLLECTION_NAME").InsertOneAsync(doc); mongoDB.GetCollection("COLLECTION_NAME").ReplaceOne(filter, doc); How to get collection back after insert/update in mong ...
Views: 107
Total Answered: 0
Total Marked As Answer: 0
Posted On: 08-Jun-2020 02:35 
 
ykl
ykl
4 Points
2 Posts
I'm trying to create unit test on service method Service.GetAllUser(). Service method using IUserRepository to fetch users. I'm trying as: public class Tests { private Mock<IUserRepository> _userRepository; private IService _service; [SetUp] public void Setup() { ...
Views: 108
Total Answered: 2
Total Marked As Answer: 1
Posted On: 05-Jun-2020 20:43 
 
kikme
kikme
32 Points
11 Posts
In asp.net core api application, we have base controller from where all application's controllers inherited. And in base controller overriding onActionExecuting method. On the basis of few condition, want to throw exception and that can be handle from action or any global middle-ware: public clas ...
Views: 119
Total Answered: 2
Total Marked As Answer: 0
Posted On: 16-May-2020 06:03 
 
edx
edx
66 Points
23 Posts
I have .netcore rest api application with NLog logging mechanism. And working fine to file, email. But now, I'm trying to ship to logz.io as mentioned in: https://docs.logz.io/shipping/log-sources/dotnet.html. NLog config: <?xml version="1.0" encoding="utf-8" ?> <nlog xmlns="http://www ...
Views: 159
Total Answered: 2
Total Marked As Answer: 1
Posted On: 06-May-2020 00:52 
 
Jak
Jak
Member
388 Points
159 Posts
I have a .NET core rest api service and controller. I'm using xUnitTest to test the controller and service. Service has a constructor argument of IOptions where AppSettings is my class for config settings. In my unit test project to test the service/controller. I'm not able to mock/initialize an i ...
Views: 397
Total Answered: 2
Total Marked As Answer: 1
Posted On: 24-Apr-2020 04:55 
 
Priya
Priya
Member
82 Points
31 Posts
I'm using xUnit test for unit testing and trying to test the api endpoints. And for this I'm trying to mock the Logger and passing to the controller. But it's showing errors: System.ArgumentNullException : Value cannot be null. (Parameter 'logger') I tried two approaches but not able to success: ...
Views: 517
Total Answered: 2
Total Marked As Answer: 1
Posted On: 21-Apr-2020 01:34 
 
 Log In to Chat