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

.NET (Core and Framework)

 
AnswerRe: MultiThread on Single Core Processor (CPU) Pin
Sam Hobbs5-Oct-22 20:19
Sam Hobbs5-Oct-22 20:19 
Question_ViewImports.cshtml question Pin
pkfox23-Aug-22 22:15
professionalpkfox23-Aug-22 22:15 
AnswerRe: _ViewImports.cshtml question Pin
Richard Deeming23-Aug-22 22:47
mveRichard Deeming23-Aug-22 22:47 
GeneralRe: _ViewImports.cshtml question Pin
pkfox23-Aug-22 23:13
professionalpkfox23-Aug-22 23:13 
GeneralRe: _ViewImports.cshtml question Pin
Richard Deeming23-Aug-22 23:29
mveRichard Deeming23-Aug-22 23:29 
GeneralRe: _ViewImports.cshtml question Pin
pkfox23-Aug-22 23:44
professionalpkfox23-Aug-22 23:44 
QuestionProblem with Azure AD JWT - solved Pin
pkfox18-Aug-22 5:56
professionalpkfox18-Aug-22 5:56 
QuestionRest API always return 401 status code Pin
Mou_kol10-Aug-22 0:59
Mou_kol10-Aug-22 0: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 4:05
mveGerry Schmitz10-Aug-22 4:05 
GeneralRe: Rest API always return 401 status code Pin
Mou_kol10-Aug-22 5:08
Mou_kol10-Aug-22 5:08 
QuestionASP.NET Core MVC: How to secure token when passing with url Pin
Mou_kol9-Aug-22 4:23
Mou_kol9-Aug-22 4:23 
AnswerRe: ASP.NET Core MVC: How to secure token when passing with url Pin
Richard Deeming9-Aug-22 5:12
mveRichard Deeming9-Aug-22 5:12 
GeneralRe: ASP.NET Core MVC: How to secure token when passing with url Pin
Mou_kol10-Aug-22 0:58
Mou_kol10-Aug-22 0:58 
QuestionGet this error when returning view Pin
pkfox3-Aug-22 22:41
professionalpkfox3-Aug-22 22:41 
AnswerRe: Get this error when returning view Pin
Richard Deeming3-Aug-22 23:25
mveRichard Deeming3-Aug-22 23:25 
GeneralRe: Get this error when returning view Pin
pkfox3-Aug-22 23:40
professionalpkfox3-Aug-22 23:40 
QuestionWhat's the difference between dotnet publish -c Release vs -c Debug? Pin
DeltaOrionis29-Jul-22 11:47
DeltaOrionis29-Jul-22 11:47 
AnswerRe: What's the difference between dotnet publish -c Release vs -c Debug? Pin
Dave Kreskowiak31-Jul-22 12:53
mveDave Kreskowiak31-Jul-22 12:53 
GeneralRe: What's the difference between dotnet publish -c Release vs -c Debug? Pin
DeltaOrionis1-Aug-22 7:59
DeltaOrionis1-Aug-22 7:59 
GeneralRe: What's the difference between dotnet publish -c Release vs -c Debug? Pin
Dave Kreskowiak1-Aug-22 8:31
mveDave Kreskowiak1-Aug-22 8:31 
GeneralRe: What's the difference between dotnet publish -c Release vs -c Debug? Pin
DeltaOrionis2-Aug-22 14:49
DeltaOrionis2-Aug-22 14:49 
QuestionVb.Net and .Net Core 6 Books Pin
crmfghtr14-Jul-22 13:27
crmfghtr14-Jul-22 13:27 
GeneralRe: Vb.Net and .Net Core 6 Books Pin
Richard MacCutchan14-Jul-22 21:13
mveRichard MacCutchan14-Jul-22 21:13 
AnswerRe: Vb.Net and .Net Core 6 Books Pin
Dave Kreskowiak15-Jul-22 8:11
mveDave Kreskowiak15-Jul-22 8:11 
AnswerRe: Vb.Net and .Net Core 6 Books Pin
Consuelo R. Bills3-Aug-22 23:57
Consuelo R. Bills3-Aug-22 23: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.