编译器错误消息:BC30002:键入' RestClient'没有定义

时间:2015-12-31 10:56:58

标签: vb.net

我正在尝试集成批量SMS API。按照他们的示例代码,我得到Compiler Error Message: BC30002: Type 'RestClient' is not defined.

代码如下

<%@ Page Language="VB" Debug = "true" ContentType="text/html"       ResponseEncoding="iso-8859-1" %>
<%@ Import Namespace="System.Data.SqlClient"%>
<%@ Import Namespace="System.net.mail"%>
<%@ Import Namespace="System.Data"%>
<%@ Import Namespace="System" %>
<%@ Import Namespace="System.Net" %>
<%@ Import Namespace="System.Net.http" %>
<%@ Import Namespace="System.text" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="microsoft.http" %>
<%@ Import namespace="System.Web.Script.Serialization" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="Restclient" %>

<SCRIPT language="vb" runat="server">


Sub Page_load(S as Object,E as EventArgs)


Dim client = New RestClient("https://api.infobip.com/sms/1/text/single")

' Dim byt As Byte() = System.Text.Encoding.UTF8.GetBytes(strOriginal)  
'
'    ' convert the byte array to a Base64 string
'
'    strModified = Convert.ToBase64String(byt)

Dim request = New RestRequest(Method.POST)
request.AddHeader("accept", "application/json")
request.AddHeader("content-type", "application/json")
request.AddHeader("authorization", "Basic   ctrtre2hvbGFkcm0xOmNoYW5nZW1lMUE=")'base64 of usename and password
request.AddParameter("application/json", "{""from"":""SMS"", ""to"":[  ""4356653443"",""2348056355307""],""text"":""Test SMS.""}", ParameterType.RequestBody)

Dim response As IRestResponse = client.Execute(request)
response.Write(response)




end sub
</SCRIPT>

请帮帮我。

1 个答案:

答案 0 :(得分:0)

由于您已经提到private function onTextAreaKeyUp( event : KeyboardEvent ) : void { // manually dispatch change event, causing TextArea's properties to // be updated in certain situations where flash's TextField control // fails to emit one automatically switch( event.keyCode ) { case 46: // delete case 13: // backspace case 8: // return var target : UITextField = event.target as UITextField; target.dispatchEvent( new Event( Event.CHANGE ) ); } } <mx:TextArea keyUp="onTextAreaKeyUp( event );" /> 我将假设您正在尝试使用RestSharp Project。您需要添加运行时二进制文件作为参考。

更简单的选择是通过Nuget添加它。

更新参考资料

在Solution Explorer中,双击项目的My Project节点。

在项目设计器中,单击“引用”选项卡。

单击“添加”按钮以打开“添加引用”对话框。

在“添加引用”对话框中,查找&#34;浏览&#34;然后在存储它的文件系统上找到dll,或者如果你在那里导航到bin。