Dim acc As TwilioRestNameSpace.Account = New TwilioRestNameSpace.Account("", "")
1) Open Visual Studio and select New Project > Visual C# > Class Library
2) Name the project TwilioTest
3) This will create a new class library project with a single class called Class1
4) Open Class1.cs and replace the contents with you C# code, and then compile it.
5) Right-click the solution and choose Add New Project. The select Visual Basic > Console Application
6) Right-click on the Console App and choose Add Reference. In the dialog that appears choose the Projects tab and select the class library project (it should be the only option)
7) In the Module1.vb file change the contents to the following:
Module Module1
Sub Main()
Dim acc As TwilioRestNameSpace.Account = New TwilioRestNameSpace.Account("", "")
End Sub
End Module
8) Right-click the Console Application and choose "Set As StartUp Project".
9) Run the project.
Imports System
Imports System.Collections
Imports TwilioRestNameSpace
Public Class SendSMSCLASS
Const API_VERSION As String = "2010-04-01"
Const ACCOUNT_SID As String = "xxx8"
Const ACCOUNT_TOKEN As String = "xxx"
'OUtgoing Caler ID previously validated with Twilio
Const CALLER_ID As String = "XXXXXXXXXXXXXXX"
'Shared Sub SENDIT(ByVal args() As String)
Public Function SENDIT()
Dim account As TwilioRestNameSpace.Account
Dim h As Hashtable
' Dim theresponse As String
' Create Twilio REST account object using Twilio account ID and token
account = New TwilioRestNameSpace.Account(ACCOUNT_SID, ACCOUNT_TOKEN)
h = New Hashtable()
h.Add("From", "xxxx")
h.Add("To", "xxxx")
h.Add("Body", "xxxx Sending SMS")
Try
' Console.WriteLine(account.request([String].Format("/{0}/Accounts/{1}/SMS/Messages", API_VERSION, ACCOUNT_SID), "POST", h))
Return (account.request([String].Format("/{0}/Accounts/{1}/SMS/Messages", API_VERSION, ACCOUNT_SID), "POST", h))
Catch e As TwilioRestException
' Console.WriteLine("An error occurred: {0}", e.Message)
Return "An error occurred: {0}" & e.Message
End Try
End Function
End Class
Public Class WebForm1
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
Dim checkit As New SendSMSCLASS
Label1 = checkit.SENDIT
End Sub
End Class
1. Generating a public key or a strong name
2. Adding the public key to the AssemblyInfo.vb file of the DLL. This step is called Signing the Assembly with a public key.
3. Build the assembly
4. Placing the dll into GAC .
1. Generating the public key:
go to visualStudio.Net command prompt and type the following command:
sn -k keyfile1.snk
Here keyfile1.snk is the keyfile we are generating.
You can store this key file in the bin folder of the assembly. In order to do this u have to go to the bin folder. For example:
C:\foldername\assemblyname
By doing this the keyfile is stored in the bin folder.
2. Placing the keyfile into the Assembly.
Go to AssemblyInfo.vb file:
<Assembly: AssemblyKeyFile("C:\folder
3. Build the Assembly.
4. Placing the assembly into GAC
There are two way in which u can place the assembly into GAC.
1. Using the utility gacutil -i
Here you should give the complete path of the dll
c:\>gactutil -i c:\foldername\assemblyname
2. The second method is u can drag the .dll file from the bin folder of the assembly and drop it into the folder C:\winnt\Assembly
Doing this is same ie placing assembly into GAC.