编译器错误信息: CS0122: 不可访问,因为它受保护级别限制 。这是为什么啊?在线等
行 22: public partial class _Default : System.Web.UI.Page
行 23: {
行 24: private HttpWebRequest myHttpWebRequest = new HttpWebRequest();
行 25: private HttpWebResponse myHttpWebResponse = new HttpWebResponse();
行 26:
源文件: d:\WebSite5\list.aspx.cs 行: 24
------解决方案--------------------HttpWebRequest wrq = HttpWebRequest.Create( ... );
------解决方案--------------------因为它的构造函数是protected or private 的不允许你new
具体可以查一下msdn
=====
ps:我的msdn坏了,最近忙来不及装,说得可能有偏差
------解决方案--------------------HttpWebRequest没有public的构造函数
------解决方案--------------------C#下可以啊但在asp.net下应该也可以吧
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.Button button1;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
// protected HttpWebRequest myHttpWebRequest=(HttpWebRequest)WebRequest.Create( "http://127.0.0.1:449 ");
private System.Windows.Forms.TextBox rtbFileContent;
protected HttpWebRequest myHttpWebRequest;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
protected HttpWebResponse myHttpWebResponse;
}
=================================================================
where