简体   繁体   English

编译器错误消息:BC30002:未定义类型“RestClient”

[英]Compiler Error Message: BC30002: Type 'RestClient' is not defined

I am trying to integrate a bulk SMS API.我正在尝试集成批量短信 API。 After following their sample code, I am getting Compiler Error Message: BC30002: Type 'RestClient' is not defined.遵循他们的示例代码后,我收到Compiler Error Message: BC30002: Type 'RestClient' is not defined.

The code is as below代码如下

<%@ 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>

Please help me.请帮我。

Since you've mentioned RestClient i'm going to assume you are trying to use the RestSharp Project .既然您提到RestClient ,我将假设您正在尝试使用RestSharp Project You'll need to add the runtime binary as a reference.您需要添加运行时二进制文件作为参考。

An easier option would be to add it via Nuget.一个更简单的选择是通过 Nuget 添加它。

UPDATE FOR ADD REFERENCE添加参考的更新

In Solution Explorer, double-click the My Project node for the project.在解决方案资源管理器中,双击项目的“我的项目”节点。

In the Project Designer, click the References tab.在项目设计器中,单击引用选项卡。

Click the Add button to open the Add Reference dialog box.单击“添加”按钮打开“添加引用”对话框。

In the Add Reference dialog box, look for "Browse" then locate the dll on the file system where you store it or navigate to the bin if you have it there.在“添加引用”对话框中,查找“浏览”,然后在存储它的文件系统上找到 dll,或者导航到 bin(如果有)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM