473,383 Members | 1,716 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Help me to solve little problem in ASP.NET

144 100+
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)
Expand|Select|Wrap|Line Numbers
  1.  
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Net;
  7. using System.IO;
  8. namespace internet
  9. {
  10.     class Program
  11.     {
  12.        static void Main(string[] args)
  13.         {
  14.             String uri = "http://mysmsaddress.net:80/smsc/general/sendsms.jsp
  15. ?
  16. userid=nlarsen&password=sam143wi&submit_name=sam&send_to=919894857426&message_type=0&message_text=Hello";
  17.             WebRequest req = WebRequest.Create(uri);
  18.             req.Method = "POST";
  19.             byte[] bytes = System.Text.Encoding.ASCII.GetBytes(uri);
  20.             req.ContentLength = bytes.Length;
  21.             Stream os = req.GetRequestStream();
  22.             os.Write(bytes, 0, bytes.Length);
  23.             os.Close();
  24.             WebResponse res = req.GetResponse();
  25.             if (res == null)
  26.                 Console.WriteLine("Response Null");
  27.             StreamReader sr = new StreamReader(res.GetResponseStream());
  28.             Console.WriteLine("Response :" + sr.ReadLine().ToString());
  29.             Console.ReadLine();
  30.         }
  31.  
  32.     }
  33. }
  34.  
  35.  
Converted Code:-(vb)
'The Below Code Should Work For Me.........its not working Now............
Expand|Select|Wrap|Line Numbers
  1.  
  2. Imports System
  3.  
  4. Imports System.Collections.Generic
  5.  
  6. Imports System.Linq
  7.  
  8. Imports System.Text
  9.  
  10. Imports System.Net
  11.  
  12. Imports System.IO 
  13. Shared Sub Main(ByVal args As String())
  14.  
  15. Dim uri As String = http://mysmsaddress.net:80
  16. /smsc/general/sendsms.jsp?
  17. userid=nlarsen&password
  18. =sam143wi&submit_name=sam&send_to=919894857426&message
  19. _type=0&message_text=Hello Dim req As WebRequest = WebRequest.Create(uri) 
  20. req.Method = "POST"
  21.  
  22. Dim bytes As Byte() = System.Text.Encoding.ASCII.GetBytes(uri) 
  23. req.ContentLength = bytes.Length
  24.  
  25. Dim os As Stream = req.GetRequestStream() 
  26. os.Write(bytes, 0, bytes.Length)
  27.  
  28. os.Close()
  29.  
  30. Dim res As WebResponse = req.GetResponse() 
  31. If res = Nothing Then
  32.  
  33. Console.WriteLine("Response Null")
  34.  
  35. End If
  36.  
  37. Dim sr As New StreamReader(res.GetResponseStream()) 
  38. Console.WriteLine("Response :" + sr.ReadLine().ToString())
  39.  
  40. Console.ReadLine()
  41.  
  42. End Sub
  43.  
  44.  

pl refer Below. for some clarification/.....................

http://www.mysmsaddress.net/SMPP%20AND%20HTTP%20API.pdf



Please Help Me...I need for My Project................

Davidson
Apr 1 '08 #1
2 1100
r035198x
13,262 8TB
What is the current output now and what should the output be?
Apr 1 '08 #2
davidson1
144 100+
Thank r03..

this program should send sms from computer to Mobile........the windows application was working i.e c#(windows) but the web applcation(Asp.net) is not working,,,,,,,,,,,,,,,,Help me i need the web application should also work.........

ie) Second code I have Send,,,,,,,,,,,,

Davidson..............
Apr 1 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Sean Berry | last post by:
I was writing a little script to test different functions of the time module. Like an idiot, I named the test script time.py. Then when I tried to do a "import time" call, I got an error. So,...
12
by: serge calderara | last post by:
Dear all, I have a function that I need to run in a thread due to the fact that it can takes long time to execute according to the amount of data to collect. This function is also populating a...
7
by: Christian Christmann | last post by:
Hi, in the past I always appreciated your help and hope that you also can help me this time. I've spent many many hours but still can't solve the problem by myself and you are my last hope. ...
28
by: stu_gots | last post by:
I have been losing sleep over this puzzle, and I'm convinced my train of thought is heading in the wrong direction. It is difficult to explain my circumstances, so I will present an identical...
3
by: Erik Thorsen | last post by:
Hello! I am in the process of creating a database listing tours, something similar to what you can find on www.infohub.com. This means that I need to create a database which can be searchable...
38
by: npc | last post by:
Hello! - I have a problem, I need to write a little program a la Mastermind in C (for school). Can anybody help me? please, contact me by e-mail. greets
6
by: Dave | last post by:
I'm struggling with something that should be fairly simple. I just don't know the regext syntax very well, unfortunately. I'd like to parse words out of what is basically a boolean search...
5
by: Jintty | last post by:
Hi, I'm trying to write a program that will read a txt file, copy it into another text file and display the number of words, lines and paragraphs. I was able to get the copying portion done, but...
7
by: yuanlinjiang | last post by:
I am working on converting a win32 console application from VC6 to VC7. My version is Microsoft Development Environment 2003 version 7.1.3088. The code works fine on VC6. it is a console...
45
by: davy.zou | last post by:
I have started learning c++ and I need help. I need to write a program, the question is as follows. At a post office, there are a certain number of 2, 7, and 9cents stamps, now, given a total...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.