Error: Cannot send a content-body with this verb-type

Hello, I've recently upgraded my VS project from VS2017 to VS2019. Also I've upgraded the dotnet framework version from 4.7.2 to 4.8. After the upgrade my routine to obtain the Authorization Token started throwing an error. Here is the code: Dim sBase64cred As String Dim client = New RestSharp.RestClient("https://authz.constantcontact.com/oauth2/default/v1/token?code=" & gclsSession.CC_API3_oAuth2Token & "&redirect_uri=" & cLocalHost & "&grant_type=authorization_code") Dim request = New RestRequest(Method.Post) Dim credentials As String = consumerKey & ":" & consumerSecret Dim plain As Byte() = System.Text.Encoding.UTF8.GetBytes(credentials) Dim response As RestResponse sBase64cred = Convert.ToBase64String(plain) Dim base64auth = "Basic " & sBase64cred request.AddHeader("content-type", "application/x-www-form-urlencoded") request.AddHeader("scope", "contact_data+offline_access") request.AddHeader("authorization", base64auth) response = client.Execute(request) This code worked perfectly prior to upgrading to VS 2019. Now, the response returns "Cannot send a content-body with this verb-type". I'm at a loss. Please advise, Thanks. Chris Campbell
1 reply
We're here to help!

Ask A Trainer

Looking for marketing assistance? Ask your questions & receive immediate guidance from our team of professionals Monday through Friday.

Leaderboard