0
this also didnot work. Thanks for your fast reply. iam stuck up with the following error :
"system.net.webexception:the remote server returned an error 417 expectation failed
at MBS.SmsMgr.SendSMS(Object stringPost)
at MBS.Dispatcher.CommonProcedures.SendSMS(CommonProcedures objparams)".
Please do find the code below :
Public Function SendSMS(ByVal stringPost As System.Object) As String Implements ISmsMgr.sendSMSDim strReturnValue As String = String.EmptyDim objWebRequest As HttpWebRequest = Nothing
Dim objWebResponse As HttpWebResponse = Nothing
Dim objStreamWriter As StreamWriter = Nothing
Dim objStreamReader As StreamReader = Nothing
Try
Dim strProxyURL As String = String.EmptyDim iProxyPort As Integer = 0If Not ConfigurationManager.AppSettings.Item("ProxyURL") Is Nothing ThenstrProxyURL = ConfigurationManager.AppSettings.Item(
"ProxyURL").ToString.TrimEnd If
If Not ConfigurationManager.AppSettings.Item("ProxyPort") Is Nothing TheniProxyPort =
CInt(ConfigurationManager.AppSettings.Item("ProxyPort").ToString.Trim)End If
Dim strSMSDialerConnectionName As String = ConfigurationManager.AppSettings("SMSDialerConnectionName")Dim iAvailConType As Integer = DetectConnection()If iAvailConType = enmConnectionType.NOTCONNECTED Then ' If not connected,
'Then detect the Modem connection and Dialp up.
If Not String.IsNullOrEmpty(strSMSDialerConnectionName) Then
Dim chSplit() As Char = {";"}Dim strDialeConnections() As String = strSMSDialerConnectionName.Split(chSplit)If strDialeConnections.Length > 0 Then
For i = 0 To strDialeConnections.Length - 1If DialupConnection(strDialeConnections(i)) TheniAvailConType = enmConnectionType.MODEM
strProxyURL =
iProxyPort = 0
String.EmptyIf Not ConfigurationManager.AppSettings.Item("DailUpProxyURL") Is Nothing ThenstrProxyURL = ConfigurationManager.AppSettings.Item(
"DailUpProxyURL").ToString.TrimEnd If
If Not ConfigurationManager.AppSettings.Item("DailUpProxyPort") Is Nothing TheniProxyPort =
CInt(ConfigurationManager.AppSettings.Item("DailUpProxyPort").ToString.Trim)End If
Exit For
End If
Next
End If
End If
End If
If iAvailConType <> enmConnectionType.NOTCONNECTED Then
objWebRequest =
Dim bytesToSend As Byte() = Encoding.UTF8.GetBytes(stringPost)Dim strSMSApi As String = ConfigurationManager.AppSettings.Item("SMSApi").ToStringDirectCast(WebRequest.Create((strSMSApi & "?") + stringPost.ToString()), HttpWebRequest)'add eventvwr : laxmanEventLog.WriteEntry(
"SENDSMS.strSMSApi ", (strSMSApi & "?") + stringPost.ToString())'(strSMSApi & "?") + stringPost.ToString()objWebRequest.Method =
"POST"
If (Not String.IsNullOrEmpty(strProxyURL.Trim)) ThenobjProxy =
objProxy.Credentials = CredentialCache.DefaultNetworkCredentials
objWebRequest.Proxy = objProxy
New WebProxy(strProxyURL, iProxyPort)End IfobjWebRequest.ContentLength = bytesToSend.Length
objWebRequest.ContentType =
"application/x-www-form-urlencoded"objStreamWriter =
objStreamWriter.Write(stringPost)
objStreamWriter.Flush()
objStreamWriter.Close()
objWebResponse =
objStreamReader =
strReturnValue = objStreamReader.ReadToEnd()
objStreamReader.Close()
New StreamWriter(objWebRequest.GetRequestStream())DirectCast(objWebRequest.GetResponse(), HttpWebResponse)New StreamReader(objWebResponse.GetResponseStream())

0
0
Hi,
Thanks for the reply.. we tested the same service in our network..it is showing succesfull..but the client is using a proxy server which i think is creating a problem..
0
Can you read HttpWebRequest's Expect property and paste it here? That should be the root cause of the problem - web request is sending something in the Expect HTTP header and remote Web server is unable to comply so it responds with 417 error.
Give us precise Expect value you're sending.
Zoran