TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Mark Tabor
585
2k
461.9k
I want to call a simple method on button click in MVC
Feb 3 2017 11:15 AM
[HttpPost]
public ActionResult SendMessage()
{
// TheTextingDemo.Models.ConfigurationSettings s1 = new Models.ConfigurationSettings();
// string API_KeY = s1.API_KEY;
string API_KEY = "wwpiub49a1";
string API_SECRET = "j5hsuadzdd";
string TO = "923215029981";
string Message = "Hello world";
string sURL;
StreamReader objReader;
//string ssurl="https://www.thetexting.com/rest/sms/json/message/send?api_key=wwpiub149a1&api_secret=j5hsuacmdzdd&to=923215029981&text=Hello"
sURL = "https://www.thetexting.com/rest/sms/json/message/send?api_key=" + API_KEY + "&api_secret=" + API_SECRET + "&to=" + TO + "&text=" + Message;
WebRequest wrGETURL;
wrGETURL = WebRequest.Create(sURL);
try
{
Stream objStream;
objStream = wrGETURL.GetResponse().GetResponseStream();
objReader = new StreamReader(objStream);
objReader.Close();
}
catch (Exception ex)
{
ex.ToString();
}
return RedirectToAction("SendSMS");
}
Hi I want to call a simple Method of sending sms from my simple View having some parameters i have written the method but when i am calling it says the resources could not found i do not want to create a view ans show it on submit i just want a method call and the view should remain the same.my method is in home controller with name SendMessage
What i have tried
<input id="Submit" type="submit" value="SendMessage" />
<input type="button" title="Delete" value="D" onclick="location.href='@Url.Action("SendMessage", "Home")'" />
but it says the resource not found and method did not called
Reply
Answers (
8
)
To get facebook contact email address in asp.net mvc5
Kannada Text Play Audi0 Formate