Last post Aug 24, 2018 05:16 AM by Nan Yu
Aug 23, 2018 01:51 AM|amendoza29|LINK
Good Day Everyone
I'm trying to call the WEB API from another site which has authentication/Login page that is using FormsAuthentication, I'm successfully calling the API when I'm typing the url below"
but when I'm calling either in Ajax/JSON or in the MVC Controller, It always return the WHOLE LOGIN PAGE HTML CODES, below is my code on the controller.
Public Async Function GetEmployees() As Task(Of List(Of tblEmployeesList))
Dim getTblEmployeesList As New List(Of tblEmployeesList)
Using client As New HttpClient
client.BaseAddress = New Uri(BaseUrl)
Dim res As HttpResponseMessage = Await client.GetAsync("api/mywa/getemployeelist")
If res.IsSuccessStatusCode = True Then
Dim EmployeesResponse = res.Content.ReadAsStringAsync().Result
getTblEmployeesList = JsonConvert.DeserializeObject(Of List(Of tblEmployeesList))(EmployeesResponse)
Catch ex As Exception
when i try to test it, an error occur and inside the res.Content.ReadAsStringAsync().Result is the whole html script of the login page
I don't know why this is occur but if there is someone who encounter this and fix this, kindly teach me masters.
Thanks and Regards
Aug 24, 2018 05:16 AM|Nan Yu|LINK
It seems the web app and web api both have authentication , so may i know what's the scenario you are facing ? How would you implement SSO between the two websites , use identity provide like identity server to issue access token to access web api ? Please
explain more about that .