如何在c#中编辑网址 [英] how to edit an url in c#

查看:95
本文介绍了如何在c#中编辑网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

void sendmsg()
{
    string strUrl = "http://api.mVaayoo.com/mvaayooapi/MessageCompose?user=t122kes@gmail.com:9768214005&senderID=TESTSMS&receipientno=+919768214005&msgtxt=faisalshaikh&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();
    response.Close();
    s.Close();
    readStream.Close();
}





i想要从文本框中输入收件人号码和文字。

应该怎么做我这样做?



i want to put the recepients number and text from a textbox.
how should i do that ?

推荐答案

尝试下面的代码



Try below code

string strUrl = "http://api.mVaayoo.com/mvaayooapi/MessageCompose?user=t122kes@gmail.com:9768214005&senderID=TESTSMS&receipientno={0}&msgtxt={1}&state=4";
strUrl = string.Format(strUrl,txtNumber.Text, txtMessage.Text);

//Here txtNumber is Textbox which contains number and txtMessage contains message text







现在,您可以在代码中使用strUrl,使用来自文本框的更新数据




Now you can use strUrl in you code with updated data from textboxes


这是因为他已经两次声明了strUrl。所以,请执行以下操作...

It is because he has declared strUrl two times. So, do like below...
string strUrl = "http://api.mVaayoo.com/mvaayooapi/MessageCompose?user=t122kes@gmail.com:9768214005&senderID=TESTSMS&receipientno={0}&msgtxt={1}&state=4";

strUrl = string.Format(strUrl, txtNumber.Text, txtMessage.Text);

//Here txtNumber is Textbox which contains number and txtMessage contains message text


导航(字符串网址)



- >更改WebBrowser的URL
Navigate(string URL)

-> Changes the URL of a WebBrowser


这篇关于如何在c#中编辑网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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