Hai friends....the below code is working well for sending sms from VS2008 C# windows Application.... .......but i want the same to work in ASP.NET(vb).... ........can anyone help me....I converted the code and tried but it didnt work........... ............... ............... .....
In the String uri....under send_to put ur mobile Number......... ......
CODING:-(c# windows Application)
Converted Code:-(vb)
'The Below Code Should Work For Me.........its not working Now............
pl refer Below. for some clarification/............... ......
Please Help Me...I need for My Project........ ........
Davidson
In the String uri....under send_to put ur mobile Number......... ......
CODING:-(c# windows Application)
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.IO;
namespace internet
{
class Program
{
static void Main(string[] args)
{
String uri = "http://mysmsaddress.net:80/smsc/general/sendsms.jsp
?
userid=nlarsen&password=sam143wi&submit_name=sam&send_to=919894857426&message_type=0&message_text=Hello";
WebRequest req = WebRequest.Create(uri);
req.Method = "POST";
byte[] bytes = System.Text.Encoding.ASCII.GetBytes(uri);
req.ContentLength = bytes.Length;
Stream os = req.GetRequestStream();
os.Write(bytes, 0, bytes.Length);
os.Close();
WebResponse res = req.GetResponse();
if (res == null)
Console.WriteLine("Response Null");
StreamReader sr = new StreamReader(res.GetResponseStream());
Console.WriteLine("Response :" + sr.ReadLine().ToString());
Console.ReadLine();
}
}
}
'The Below Code Should Work For Me.........its not working Now............
Code:
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Text
Imports System.Net
Imports System.IO
Shared Sub Main(ByVal args As String())
Dim uri As String = http://mysmsaddress.net:80
/smsc/general/sendsms.jsp?
userid=nlarsen&password
=sam143wi&submit_name=sam&send_to=919894857426&message
_type=0&message_text=Hello Dim req As WebRequest = WebRequest.Create(uri)
req.Method = "POST"
Dim bytes As Byte() = System.Text.Encoding.ASCII.GetBytes(uri)
req.ContentLength = bytes.Length
Dim os As Stream = req.GetRequestStream()
os.Write(bytes, 0, bytes.Length)
os.Close()
Dim res As WebResponse = req.GetResponse()
If res = Nothing Then
Console.WriteLine("Response Null")
End If
Dim sr As New StreamReader(res.GetResponseStream())
Console.WriteLine("Response :" + sr.ReadLine().ToString())
Console.ReadLine()
End Sub
pl refer Below. for some clarification/............... ......
Please Help Me...I need for My Project........ ........
Davidson
Comment