The underlying connection was closed: The remote name could not be resolved.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • davidson1
    New Member
    • Feb 2008
    • 144

    The underlying connection was closed: The remote name could not be resolved.

    Hai in my Project how to send sms from computer to mobile ....

    Front-End :- ASP.NET(vb)



    I am using the following code, but it shows me a ERROR

    "The underlying connection was closed: The remote name could not be resolved. "

    You can check by putting Ur mobile number....wheat her you get sms or not

    gateway is correct one

    I have checked this in net and did some modification in machine.config and web.config, But it is still not working

    if anybody know pl reply to me........

    Thanks in advance........ ......



    Imports System.Text
    Imports System.Net
    Imports System.IO
    Imports System.Collecti ons.Specialized
    Imports System
    Imports System.Collecti ons
    Imports System.Componen tModel
    Imports System.Data
    Imports System.Web
    Imports System.Web.Sess ionState

    Dim strUrl, strUser, strPass, strFrom, strTo, strText As String

    strUrl = "http://mysmsadress.net :80/smsc/general/sendsms.jsp?use rid=nlarsen&pas sword=sam143wi& submit_name=dav id&send_to=9486 309490&message_ type=0&message_ text=hu"

    strUser = "nlarsen"
    strPass = "sam143wi"
    strFrom = "Hai"
    strTo = "9486309490 "
    strText = "Hello"


    Dim values As New System.Collecti ons.Specialized .NameValueColle ction
    values.Add("use r", strUser)
    values.Add("pas s", strPass)
    values.Add("fro m", strFrom)
    values.Add("to" , strTo)
    values.Add("tex t", strText)

    Dim postData As String = String.Empty
    For i As Integer = 0 To values.Keys.Cou nt - 1
    If i > 0 Then
    postData &= "&"
    End If
    postData &= values.Keys(i) & "=" & values(values.K eys(i))
    Next

    Dim request As System.Net.Http WebRequest
    request = System.Net.Http WebRequest.Crea te(strUrl)
    request.Method = "POST"
    request.Content Type = "applicatio n/x-www-form-urlencoded"

    Dim stream As IO.Stream = request.GetRequ estStream
    Dim bytes As Byte() = System.Text.Enc oding.UTF8.GetB ytes(postData)
    stream.Write(by tes, 0, bytes.Length)
    stream.Close()

    Dim response As System.Net.Http WebResponse
    response = request.GetResp onse

    Dim sr As IO.StreamReader = New IO.StreamReader (response.GetRe sponseStream)
    Dim result As String = sr.ReadToEnd
    sr.Close()

    Posted Date: - 19 Feb 2008

    Davidson.....
Working...