使用C#在asp.net中导航 [英] Navigation in asp.net using c#

查看:67
本文介绍了使用C#在asp.net中导航的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在使用短信服务从我们的网站发送短信.通过将所有必需的数据嵌入url中来发送短信,如下所示:
字符串sms_msg ="http://bulksms.serviceprovider.com:8080/WebSMS/SMSAPI.jsp?username=username&password
= password& sendername =发件人id& mobileno = 919999999999& message =你好"


Response.Redirect(sms_msg);

我在页面上收到一条消息.邮件发送成功

问题是,当我使用上面的语句时,发送了短信,并且控制权转到了上面的页面.我怎么知道短信是否已正确发送,并将控件返回到上一页.

We are using sms service to send sms from our site. The sms is sent by embedding all required data in the url as under

string sms_msg = "http://bulksms.serviceprovider.com:8080/WebSMS/SMSAPI.jsp?username=username&password
=password&sendername=sender id&mobileno=919999999999&message=Hello"


Response.Redirect ( sms_msg );

I get a message on the page. Message sent successfully

The issue is that when i use above statement, the sms is sent and control goes to the above page. How do i know whether sms was sent properly and get the control back to previous page.

推荐答案

您可以使用以下几行进行相同的操作.这会将控件保留在您的页面上,并使用Web请求发送SMS.

You can use the below lines to do the same. This will keep the control on your page and will send the SMS using a web request.

HttpWebRequest httpReq = (HttpWebRequest)WebRequest.Create(sms_msg);
HttpWebResponse httpResponse = (HttpWebResponse)(httpReq.GetResponse());
using (StreamReader rdr = new StreamReader(httpResponse.GetResponseStream()))
{
     string result = rdr.ReadLine();
     Response.WriteLine(result);
}



如果您发现任何问题,请告诉我.



Let me know in case you find any issues.


这篇关于使用C#在asp.net中导航的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆