我没有收到错误消息,而是出现“无效登录”消息,这让我认为表单实际上发出了 Post 请求。无论如何,这是一个获取请求示例:
using System;
using System.Net;
using System.Text;
using System.IO;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
StringBuilder sb = new StringBuilder();
byte[] buf = new byte[8192];
//do get request
HttpWebRequest request = (HttpWebRequest)
WebRequest.Create("http://sms-om.com/smspro/sendsms.php?user=HatemSalem");
HttpWebResponse response = (HttpWebResponse)
request.GetResponse();
Stream resStream = response.GetResponseStream();
string tempString = null;
int count = 0;
//read the data and print it
do
{
count = resStream.Read(buf, 0, buf.Length);
if (count != 0)
{
tempString = Encoding.ASCII.GetString(buf, 0, count);
sb.Append(tempString);
}
}
while (count > 0);
Response.Write(sb.ToString());
}
}
祝你好运!