请问这有什么错误??

orArvin 2003-05-19 11:42:56
using System;
using System.Net;
using System.IO;
using System.Text;

public class Req_Get
{
public Req_Get()
{
HttpWebRequest webreq= ( HttpWebRequest ) WebRequestFactory.Create("http://localhost/bbs/index.asp");
HttpWebResponse webresp= (HttpWebResponse ) webreq.GetResponse();
StreamReader strm=new StreamReader (webresp.GetResponseStream(),Encoding.ASCII);
string sLIne;
do
{
sLine=strm.ReadLine();
WriteLine(sline);
}while(sLine!=null);
strm.Close;
}
public static void Main()
{
Application.Run(new Reg_Get());
}
}


总有这种错误提示:
fatal error CS2008: No inputs specified
...全文
34 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
bytepark 2003-05-19
  • 打赏
  • 举报
回复
My Sample:
HttpWebRequest webReq =(HttpWebRequest)WebRequest.Create(strUrl);
HttpWebResponse webRes = (HttpWebResponse)webReq.GetResponse();
Stream receiveStream = webRes.GetResponseStream();
Encoding encode = System.Text.Encoding.GetEncoding("gb2312");
StreamReader readStream = new StreamReader( receiveStream, encode );

string strHtml = readStream.ReadToEnd();
Knight94 2003-05-19
  • 打赏
  • 举报
回复
把循环改成如下试试
do
{
sLine=strm.ReadLine();
if(sLine!=null)
WriteLine(sline);
}while(sLine!=null);
orArvin 2003-05-19
  • 打赏
  • 举报
回复
不好意思,有个拼写错误 string sLIne; 应为 string sLine;

但不是这儿的错!!
orArvin 2003-05-19
  • 打赏
  • 举报
回复
噢!!谢谢!!
Knight94 2003-05-19
  • 打赏
  • 举报
回复
改成如下:
public static void Main()
{
Reg_Get myGet=new Reg_Get();
myGet.Req_Get();
}
Knight94 2003-05-19
  • 打赏
  • 举报
回复
这句话Application.Run(new Reg_Get());有问题,
你看看Application.Run的说明,不能这样用。
orArvin 2003-05-19
  • 打赏
  • 举报
回复
又错了!
Reg_Get应为Req_Get

但他又说,Req_Get和它的封装类型一样!!??
orArvin 2003-05-19
  • 打赏
  • 举报
回复
Knight94(愚翁) 你是说,sLine 可能已开始就为空??
好像不是,现在我又改了改!!
如下:
using System;
using System.Net;
using System.IO;
using System.Text;
using System.Windows.Forms;


class Req_Get
{
public void Req_Get()
{
try
{
HttpWebRequest webreq= ( HttpWebRequest ) WebRequest.Create("http://localhost/bbs/index.asp");
HttpWebResponse webresp= (HttpWebResponse ) webreq.GetResponse();
StreamReader strm=new StreamReader (webresp.GetResponseStream(),Encoding.ASCII);
string sLine;
do
{
sLine=strm.ReadLine();
if(sLine!=null)
Console.WriteLine(sLine);
}while(sLine!=null);
strm.Close();
}
catch
{
MessageBox.Show("Try 错误!");
}
}
public static void Main()
{
Application.Run(new Reg_Get());
}
}


又有这种错误:
The type or namespace name "Reg_Get" could not be found (are you missing a using directive or an assembly reference?)

110,539

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧