Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8354997
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T09:43:35+00:00 2026-06-09T09:43:35+00:00

In this web application I want to send an sms to a mobile ann.

  • 0

In this web application I want to send an sms to a mobile ann. This is my code of aspx.cs file:

protected void buttonSendOnClick(object sender, EventArgs e)
{
    //are required fields filled in:
    if (textboxRecipient.Text == "")
    {
         textboxError.Text += "Recipient(s) field must not be empty!\n";
         textboxError.Visible = true;
         return;
    }
        //we creating the necessary URL string:
    string ozSURL = "http://127.0.0.1"; //where Ozeki NG SMS Gateway is running
    string ozSPort = "9501"; //port number where Ozeki NG SMS Gateway is listening
    string ozUser = HttpUtility.UrlEncode("admin"); //username for successful login
    string ozPassw = HttpUtility.UrlEncode("abc123"); //user's password
    string ozMessageType = "SMS:TEXT"; //type of message
    string ozRecipients = HttpUtility.UrlEncode( textboxRecipient.Text); //who will        

 //get the message
    string ozMessageData = HttpUtility.UrlEncode(textboxMessage.Text); //body of  
 //message

     string createdURL = ozSURL + ":" + ozSPort + "/httpapi" +
          "?action=sendMessage" +
            "&username=" + ozUser +
            "&password=" + ozPassw +
            "&messageType=" + ozMessageType +
            "&recipient=" + ozRecipients +
            "&messageData=" + ozMessageData;

   try
   {
            //Create the request and send data to Ozeki NG SMS Gateway Server by HTTP 
connection
            HttpWebRequest myReq = (HttpWebRequest)WebRequest.Create(createdURL);

            //Get response from Ozeki NG SMS Gateway Server and read the answer
            HttpWebResponse myResp = (HttpWebResponse)myReq.GetResponse();
            System.IO.StreamReader respStreamReader = new 
 System.IO.StreamReader(myResp.GetResponseStream());
            string responseString = respStreamReader.ReadToEnd();
            respStreamReader.Close();
            myResp.Close();

            //inform the user
            string result = Regex.Replace(responseString, @"<[^>]*>", string.Empty);
            textboxError.Text = Server.HtmlEncode( result);
            textboxError.Visible = true;
        }
        catch (Exception)
        {
            //if sending request or getting response is not successful Ozeki NG SMS                 
  Gateway Server may do not run
            textboxError.Text = "Ozeki NG SMS Gateway Server is not running!";
            textboxError.Visible = true;
        }

    }

After I run I got text as xml doc like this

<Responses>
<Response0>
    <Action>sendMessage</Action>
    <Data>
        <AcceptReport>
            <StatusCode>0</StatusCode>
            <StatusText>Message accepted for delivery</StatusText>
            <MessageID>89c8011c-e291-44c3-ac72-cd35c76cb29d</MessageID>
            <Recipient>+85568922903</Recipient>
        </AcceptReport>
    </Data>
</Response0>
</Responses>

but I want it diplay as

Message accepted for delivery
Message ID: IEUHSHIL
Recipient: +441234567

So how can I do this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T09:43:36+00:00Added an answer on June 9, 2026 at 9:43 am

    you got a json result :

    You converted it into string and then replaced braces with spaces , Thats why you got xml.

    Recheck these lines :

     //inform the user
                string result = Regex.Replace(responseString, @"<[^>]*>", string.Empty);
                textboxError.Text = Server.HtmlEncode( result);
    

    Check ResponseString and extract the required data from it.

    Helpful links :
    reading HttpwebResponse json response, C#
    , how to split json format string in order to Deserialize is into .net object?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just want to send SMS from my web application in PHP. Can anyone
following situation: I want to send in app SMS. This is my code creating
I want to do this web application I am creating in the best possible
I'm developing web-application, in this I want to add all months values on the
I want to add a dashboard functionality to an existing java web application, this
In this case, I've developed a CSS code for this web application ..and sometimes
I have C# web application that I want it to send out an email
I have a web application where I want to send commands to a command
I want to send email with my web application. It is published on rackspace
We want to send mail from inside my tomcat web application. I inherited some

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.