Click here to Skip to main content
15,796,102 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
AnswerRe: MultiThread on Single Core Processor (CPU) Pin
Sam Hobbs5-Oct-22 21:19
Sam Hobbs5-Oct-22 21:19 
Question_ViewImports.cshtml question Pin
pkfox23-Aug-22 23:15
professionalpkfox23-Aug-22 23:15 
AnswerRe: _ViewImports.cshtml question Pin
Richard Deeming23-Aug-22 23:47
mveRichard Deeming23-Aug-22 23:47 
GeneralRe: _ViewImports.cshtml question Pin
pkfox24-Aug-22 0:13
professionalpkfox24-Aug-22 0:13 
GeneralRe: _ViewImports.cshtml question Pin
Richard Deeming24-Aug-22 0:29
mveRichard Deeming24-Aug-22 0:29 
GeneralRe: _ViewImports.cshtml question Pin
pkfox24-Aug-22 0:44
professionalpkfox24-Aug-22 0:44 
QuestionProblem with Azure AD JWT - solved Pin
pkfox18-Aug-22 6:56
professionalpkfox18-Aug-22 6:56 
QuestionRest API always return 401 status code Pin
Mou_kol10-Aug-22 1:59
Mou_kol10-Aug-22 1:59 
I am working with Nasdaq Fund Network Data Service first time. i am calling their one of the API where passing user id,pwd and access key but always getting 401 status code. i am not able to figure out what is wrong in my http call. please some one have a look at the code and tell me where i made the mistake for which i am getting 401 status code instead of right response.

here is my sample code where i could not share actual credentials and access key.
C#
string url = "https://nfn.nasdaq.com/servicecall/tempsession";
 Uri u = new Uri(url);
    
 string username = "test1";
 string password = "test1";
 string accessKey = "my key";
    
 var payload = new Dictionary<string, string>
 {
   {"username", username},
   {"password", password},
   { "accesskey", accessKey}
 };
    
 string strPayload = JsonConvert.SerializeObject(payload);
 HttpContent c = new StringContent(strPayload, Encoding.UTF8, "application/x-www-form-urlencoded");
    
 var response = string.Empty;
 ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11;
 using (var client = new HttpClient())
 {
  //client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", accessKey);
  //client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Authorization", "Bearer " + accessKey);
    
  HttpRequestMessage request = new HttpRequestMessage
  {
  Method = HttpMethod.Post,
  RequestUri = u,
  Content = c
  };
    
  var result = client.SendAsync(request).Result;
  if (result.IsSuccessStatusCode)
  {
  response = result.StatusCode.ToString();
  }
 }


modified 10-Aug-22 9:50am.

AnswerRe: Rest API always return 401 status code Pin
Gerry Schmitz10-Aug-22 5:05
mveGerry Schmitz10-Aug-22 5:05 
GeneralRe: Rest API always return 401 status code Pin
Mou_kol10-Aug-22 6:08
Mou_kol10-Aug-22 6:08 
QuestionASP.NET Core MVC: How to secure token when passing with url Pin
Mou_kol9-Aug-22 5:23
Mou_kol9-Aug-22 5:23 
AnswerRe: ASP.NET Core MVC: How to secure token when passing with url Pin
Richard Deeming9-Aug-22 6:12
mveRichard Deeming9-Aug-22 6:12 
GeneralRe: ASP.NET Core MVC: How to secure token when passing with url Pin
Mou_kol10-Aug-22 1:58
Mou_kol10-Aug-22 1:58 
QuestionGet this error when returning view Pin
pkfox3-Aug-22 23:41
professionalpkfox3-Aug-22 23:41 
AnswerRe: Get this error when returning view Pin
Richard Deeming4-Aug-22 0:25
mveRichard Deeming4-Aug-22 0:25 
GeneralRe: Get this error when returning view Pin
pkfox4-Aug-22 0:40
professionalpkfox4-Aug-22 0:40 
QuestionWhat's the difference between dotnet publish -c Release vs -c Debug? Pin
DeltaOrionis29-Jul-22 12:47
DeltaOrionis29-Jul-22 12:47 
AnswerRe: What's the difference between dotnet publish -c Release vs -c Debug? Pin
Dave Kreskowiak31-Jul-22 13:53
mveDave Kreskowiak31-Jul-22 13:53 
GeneralRe: What's the difference between dotnet publish -c Release vs -c Debug? Pin
DeltaOrionis1-Aug-22 8:59
DeltaOrionis1-Aug-22 8:59 
GeneralRe: What's the difference between dotnet publish -c Release vs -c Debug? Pin
Dave Kreskowiak1-Aug-22 9:31
mveDave Kreskowiak1-Aug-22 9:31 
GeneralRe: What's the difference between dotnet publish -c Release vs -c Debug? Pin
DeltaOrionis2-Aug-22 15:49
DeltaOrionis2-Aug-22 15:49 
QuestionVb.Net and .Net Core 6 Books Pin
crmfghtr14-Jul-22 14:27
crmfghtr14-Jul-22 14:27 
GeneralRe: Vb.Net and .Net Core 6 Books Pin
Richard MacCutchan14-Jul-22 22:13
mveRichard MacCutchan14-Jul-22 22:13 
AnswerRe: Vb.Net and .Net Core 6 Books Pin
Dave Kreskowiak15-Jul-22 9:11
mveDave Kreskowiak15-Jul-22 9:11 
AnswerRe: Vb.Net and .Net Core 6 Books Pin
Consuelo R. Bills4-Aug-22 0:57
Consuelo R. Bills4-Aug-22 0:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.