Click here to Skip to main content
15,893,487 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi to Everyone,

my problem is,
I am using the SMS API in my website for sms sending to user & receiving from user
so when i send the sms they are properly send my code is, for sms sending is

string result = "";
            WebRequest request = null;
            HttpWebResponse response = null;
            try
            {
                String sendToPhoneNumber = ph;
                String msg = "12345erfdr";
                String userid = "20xxxxx";
                String passwd = "rereree";
                String url =
                "http://SMS/Receive.aspx?method=sendMessage&send_to=" + sendToPhoneNumber + "&msg=" + msg + " &userid=" + userid + "&password=" + passwd + "&v=1.1 & msg_type = TEXT & auth_scheme = PLAIN" + "";
                request = WebRequest.Create(url);
                //in case u work behind proxy, uncomment the
                /*WebProxy proxy = new WebProxy("http://proxy:80/",true);
                proxy.Credentials = new NetworkCredential("userId","password", "Domain");
                request.Proxy = proxy;*/
                // Send the 'HttpWebRequest' and wait for response.
                response = (HttpWebResponse)request.GetResponse();
                Stream stream = response.GetResponseStream();
                Encoding ec = System.Text.Encoding.GetEncoding("utf-8");
                StreamReader reader = new
                System.IO.StreamReader(stream, ec);
                result = reader.ReadToEnd();
                Console.WriteLine(result);
                reader.Close();
                stream.Close();
            }
            catch (Exception exp)
            {
                Console.WriteLine(exp.ToString());
            }
            finally
            {
                if (response != null)
                    response.Close();
            }


& for receiving the sms I set the URL of my page on which i receive sms is set to the SMS API Response URL.
& I get the parameter from these response url on my page is,

C#
if (Request.Form["phonecode"] != null)
            {

                pcode = Request.Form["phonecode"].ToString();

            }


but these parameter are not get then how to get these paramter?
Posted
Updated 22-Mar-11 1:01am
v3

How To Get Parameter From URL
Instead of Request.Form, use Request.QueryString to get the parameters defined in the URL.
Request["fieldname"] works as well.

As you say, parameters in URL are called as querystring.

Here for details: Passing variables between pages using QueryString[^]
 
Share this answer
 
v3
Comments
rakesh-s-shinde 22-Mar-11 7:13am    
I Tried Request.Querystring[""] but its not work,i think these respone url is comes from SMS API then these method is not work, Is it right or wrong? please tell me bcoz i m new in ASP.NET
Sandeep Mewara 22-Mar-11 7:26am    
Request.Querystring["QUERYSTRINGNAME"] - this should work as long as the querystring named QUERYSTRINGNAME is there in the URL.

Hi rakesh-s-shinde,

Try this Link[^]

I hope it helps,
:)
 
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