0
我在visual basic中找到了一些示例源代碼來調用REST API。但是,我需要通過添加兩個請求標頭來修改代碼。在Visual Basic中設置用於獲取REST API的RequestHeaders
' Create the web request
request = DirectCast(WebRequest.Create(sURI), HttpWebRequest)
'Update request headers with request pairs Header1/"header1 value" and header2/"header2 value"
??? HttpWebRequest.headers.Add ????
' Get response
response = DirectCast(request.GetResponse(), HttpWebResponse)
' Get the response stream into a reader
reader = New StreamReader(response.GetResponseStream())
任何幫助,將不勝感激。謝謝!
用戶要求輸入VB代碼,而不是C#。 –