Somehow when using Windows mode, I get an Exception Error"Reference to undeclared entity 'nbsp'. Line 69, position 41."" weird. Then when I check the result.Content after executing I get like an html page with errors like 401 - Unauthorized: Access is denied due to invalid credentials. This is an issue that happens on the IIS Server too.
Below is my RestSharp Code from ActionResult
- var client = new RestClient(Request.Url.GetLeftPart(UriPartial.Authority).ToString());
- var request = new RestRequest("http://domain.co.za/api/student/getBookedSlotHistory", Method.POST);
- request.AddHeader("cache-control", "no-cache");
- request.AddObject(new StudentInput()
- {
- StudentNumber = "219193029"//UserIdentity.Username()
- });
- var result = client.Execute
(request); - var data = JsonConvert.DeserializeObject
(result.Content);
Then below is my APIController
- [HttpPost]
- [Route("api/student/getBookedSlotHistory")]
- public async Task
GetHistory(StudentInput input) - {
- return await _studentRepository.GetBookingHistoryData(input);
- }
Anele NgqanduPosted May 3, 2019, 5:29 AM
Bryian TanPosted May 2, 2019, 11:46 PM
https://www.c-sharpcorner.com/article/enable-windows-authentication-in-web-api-and-angular-app/
https://docs.microsoft.com/en-us/aspnet/core/security/authentication/windowsauth?view=aspnetcore-2.2&tabs=visual-studio
Ahmed AbdiPosted May 2, 2019, 11:40 AM