edx
72
Points
26
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:
150
Total Answered:
1
Total Marked As Answer:
0
Posted On:
26-Oct-2020 00:36
|
Jak
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:
308
Total Answered:
1
Total Marked As Answer:
0
Posted On:
30-Sep-2020 03:26
|
edx
72
Points
26
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:
769
Total Answered:
2
Total Marked As Answer:
1
Posted On:
11-Sep-2020 05:35
|
beginer
190
Points
55
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:
252
Total Answered:
1
Total Marked As Answer:
1
Posted On:
14-Aug-2020 05:52
|
beginer
190
Points
55
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:
353
Total Answered:
1
Total Marked As Answer:
0
Posted On:
09-Jul-2020 00:07
|
beginer
190
Points
55
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:
244
Total Answered:
1
Total Marked As Answer:
0
Posted On:
08-Jul-2020 23:52
|
Jak
392
Points
161
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:
450
Total Answered:
1
Total Marked As Answer:
1
Posted On:
30-Jun-2020 23:25
|
edx
72
Points
26
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:
233
Total Answered:
0
Total Marked As Answer:
0
Posted On:
08-Jun-2020 02:35
|
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:
274
Total Answered:
2
Total Marked As Answer:
1
Posted On:
05-Jun-2020 20:43
|
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:
340
Total Answered:
2
Total Marked As Answer:
0
Posted On:
16-May-2020 06:03
|