I’ve an WEB application with aspx page (No database, very simple web application). But Now I need to add some API services. I would add controler like when I programm in MVC but is it possible. I try but no success to call my controler, even directly in url
Imports Microsoft.AspNetCore.Mvc
<ApiController>
<Route("[Testouille]")>
Public Class LicencingYIController
Inherits ControllerBase
<HttpGet>
Public Function GetCustomHeader() As ActionResult(Of String)
Dim customHeader As String = Request.Headers("Custom-Header")
If String.IsNullOrEmpty(customHeader) Then
Return BadRequest("Custom header 'Custom-Header' is missing.")
Else
Return Ok("Received custom header: " & customHeader)
End If
End Function
End Class
I try from my visual studio https://localhost:myport/Testouille/GetCustomHeader
but nothing pass. I don’t enter my GetCustomHeader function (break point)
Then I just ask if is it possible or perhaps finnally better to make an asmx ?
Thanks fot your help.
2
Answers
Finnally ... U can with web api controler
I let the header reader... always good to take Don't forget initialyse the route
To call it in global.asax.start
and Call API, like that
No, it’s more easy create new.