Reputation: 664
I'm trying to get post data into my controller.
It tells me that Request.Form
does not exists, any ideas how I then get the post data for my application?
Here is my code:
Imports System.Net
Imports System.Web.Http
Public Class Car
Public Name As String
Public Sub New(ByVal iName As String)
Name = iName
End Sub
End Class
Public Class CarController
Inherits ApiController
Public Function PostCar() As Car
Return New Car(Request.Form["name"])
End Function
End Class
Upvotes: 0
Views: 51
Reputation: 1898
Try below code,
Public Class CarController
Inherits ApiController
Public Function PostCar() As Car
Return New Car(Request.Form("name"))
End Function
End Class
Upvotes: 1