如何在c#中编辑网址

如何在c#中编辑网址

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

问题描述

void sendmsg()
{
    string strUrl = "http://api.mVaayoo.com/mvaayooapi/[email protected]: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 ?

推荐答案

string strUrl = "http://api.mVaayoo.com/mvaayooapi/[email protected]: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


string strUrl = "http://api.mVaayoo.com/mvaayooapi/[email protected]: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



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

09-13 09:41