1

I am using way2sms third party control for sending sms from my pc to mobile in my application. Here is my code.

SendSms sms = new SendSms();
string status=sms.send(txtID.Text, txtPass.Text, txtMessage.Text, txtMN.Text);
if (status == "1")
    MessageBox.Show("Sent successfully", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
else if (status == "2")
    MessageBox.Show("No Internet Connection", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
else
    MessageBox.Show("ID or Password is not correct", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);`  

Every time i get the Error "2" which says No Internet Connection.

Anyone is there to help me out ?

Ondrej Janacek
  • 12,486
  • 14
  • 59
  • 93
Sujith H S
  • 477
  • 8
  • 18
  • Please, do not include information about a language used in a question title unless it wouldn't make sense without it. Tags serve this purpose. – Ondrej Janacek Mar 04 '14 at 07:06
  • Ok @OndrejJanacek.Thanks for the suggestion.Can you help me out in fixing this issue? – Sujith H S Mar 04 '14 at 07:15
  • is return type of `sms.send()` a string? Generally, it should be `int` if it really returns integer only. The error is with `.send()` method itself. For some reason, it is returning `2`. A deeper inspection is needed to find out the root cause. – Atanu Roy Mar 04 '14 at 08:56
  • @ChandanRoy what you are telling me to do exactly even I checked with the return type of the method `sms.send()`. I am not getting why it is always returning error "2" because **No internet connection** is a user defined message. I dont know what exactly the wrong is. – Sujith H S Mar 04 '14 at 09:23
  • Do you have access to the source of `.send()` method? – Atanu Roy Mar 06 '14 at 06:50
  • How you came to know that status '2' means "No Internet Connection" and not something else? Is it written in the documentation?? – Atanu Roy Mar 06 '14 at 06:52
  • @ChandanRoy No.There is no such information about that error in documentation.This code i got in Internet and whatever the error text there I am printing here same. Can you tel what that error "2" actually means. Because i have a fair internet connection and every time the message is same whether you connect internet or not. I think the actual problem is different. Please help me out. – Sujith H S Mar 07 '14 at 04:29
  • Which DLL exposes this class `SendSms`? We need to look into the source of this DLL. If you don't have source code of this dll, we have to use a debugger to inspect into this. If you have the source, put Breakpoints and inspect where is the problem. Can you provide a link to this dll? – Atanu Roy Mar 07 '14 at 08:31
  • Generally, this kind of DLL work with a `HttpWebRequest`. This object calls an external URL along with some query strings to send the sms. I guess that object is not working properly or the URL is not reachable. – Atanu Roy Mar 07 '14 at 08:34
  • Here is a [link](http://forums.asp.net/t/1949474.aspx?send+sms+using+way2sms). Here you can get some idea about that `.send()` method. – Atanu Roy Mar 07 '14 at 08:36
  • @ChandanRoy Thanks for the try. But I am using c# for developing winform application. I am using `SmsClient.dll` file. Can you tell how to debug this dll file ? – Sujith H S Mar 07 '14 at 09:32
  • Be it winform project or a Web application, the behavior of your DLL should be same in every case. Unless you have the source of that DLL, its not easy to debug that. You can do one thing, try to track if your application is generating any HTTP request or not. – Atanu Roy Mar 07 '14 at 09:53
  • My point is, it is exactly not 'No Internet Connection' error. Some other way the HTTP request is not being sent. – Atanu Roy Mar 07 '14 at 09:56
  • Hi, @SujithHS, i am searching for the same answer because it is giving 2 everytime, have you find the answer? if yes could you share with me? – Gurunadh May 03 '14 at 08:40
  • Yes..But i didn't get the solution for that. The problem is with the dll file(SmsClient.dll) actually. Couldn't get the proper one. – Sujith H S May 06 '14 at 04:03

0 Answers0