Click here to Skip to main content
15,906,329 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
i have a api given by sms gateway company which will look like..

string strUrl =  " is a test API&state=4"; 
WebRequest request = HttpWebRequest.Create(strUrl);
HttpWebResponse response = (HttpWebResponse)request.GetResponse(); 
Stream s = (Stream)response.GetResponseStream();
StreamReader readStream = new StreamReader( s );
string dataString = readStream.ReadToEnd();

so how to implement this into my asp.net4.5 MVC4.0 Website so that when i click on confirm button that will send message to the customer...

really appreciate your help
Updated 7-Jan-14 5:48am
ZurdoDev 7-Jan-14 11:20am    
You have the code. Where are you stuck?

1 solution

In the corresponding controller, add an action that is initiated by your confirm button. It should then create strUrl from scratch, based on the user and senderId that your SMS company has provided, along with the recipient's number and the message. Then the rest of that snippet can be executed. The snippet that you provided will contact a RESTful web service at your SMS provider's gateway, which will create the SMS message on the cellular network.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900