这是我写的第一个asp.net程序,使用的开发环境是vs.net,可是在ie中打开时总是出错,请大家帮忙看看:错误提示如下:
=========================
编译错误 
说明: 在编译向该请求提供服务所需资源的过程中出现错误。请检查下列特定错误详细信息并适当地修改源代码。 编译器错误信息: CS0122: 不可访问“xfznet.edit.login.DoLogin()”,因为它受保护级别限制源错误: 行 18:  <asp:radiobuttonlist id="txtUserType" runat="server" RepeatColumns="3" RepeatDirection="Horizontal" RepeatLayout="Flow"></asp:radiobuttonlist></P>
行 19:  <div id="outMessage" runat="server" />
行 20:  <input id="Submit1" type="submit" value="Login" name="Submit1" runat="server" onserverclick="DoLogin">
行 21:      </form>asp.net程序如下(名为login.aspx):
=====================================
<%@ Page language="c#" Codebehind="login.aspx.cs" AutoEventWireup="false" Inherits="xfznet.edit.login" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > <html>
  <head>
    <title>login</title>
    <meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
    <meta name="CODE_LANGUAGE" Content="C#">
    <meta name=vs_defaultClientScript content="JavaScript">
    <meta name=vs_targetSchema content="http://schemas.microsoft.com/intellisense/ie5">
  </head>
  <body MS_POSITIONING="GridLayout">

    <form id="Form1" method="post" runat="server">
<P>用户名: <input id="Text1" type="text" name="txtUsr" runat="server"></P>
<P>口&nbsp;&nbsp; 令: <input id="Password1" type="password" name="txtPwd" runat="server"></P>
<P>角&nbsp;&nbsp; 色:
<asp:radiobuttonlist id="txtUserType" runat="server" RepeatColumns="3" RepeatDirection="Horizontal" RepeatLayout="Flow"></asp:radiobuttonlist></P>
<div id="outMessage" runat="server" />
<input id="Submit1" type="submit" value="Login" name="Submit1" runat="server" onserverclick="DoLogin">
     </form>

  </body>
</html>
c#程序如下(名为login.aspx.cs):
=========================================
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using Microsoft.ApplicationBlocks.Data;namespace xfznet.edit
{
/// <summary>
/// login 的摘要说明。
/// </summary>
public class login : System.Web.UI.Page
{
protected System.Web.UI.HtmlControls.HtmlInputText txtUsr;
protected System.Web.UI.HtmlControls.HtmlInputText txtPwd;
protected System.Web.UI.WebControls.RadioButtonList userType;
protected System.Web.UI.HtmlControls.HtmlGenericControl outMessage; private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
} private void DoLogin()
{
string CONN_STRING = "SERVER=(127.0.0.1); DATABASE=data; USER ID=sa; PASSWORD=lepilu!;";
// get username and password from form
string strUsr = txtUsr.Value;
string strPwd = txtPwd.Value;
//string strUserType = txtUserType.Value; // set a flag to indicate successful authentication
bool blnIsAuthenticated = false;   // default value
SqlDataReader dr=null; // 检索各类高级用户账户
if (!blnIsAuthenticated)
{
string strSQL = "SELECT 岗位,真实姓名 FROM M01_用户账号 WHERE 用户名='"
+ strUsr + "' AND 密码='" + strPwd + "'";
dr = SqlHelper.ExecuteReader(CONN_STRING,CommandType.Text, strSQL);
if (dr.Read())
{
//设置检索标志
blnIsAuthenticated = true; //添加用户名到cookie
HttpCookie userName = new HttpCookie("username");
userName.Value = strUsr;
Response.Cookies.Add(userName); //添加岗位到cookie
HttpCookie userGangWei = new HttpCookie("usergangwei");
userGangWei.Value = dr.GetString(0);
Response.Cookies.Add(userGangWei); //添加真实姓名到cookie
HttpCookie name = new HttpCookie("name");
name.Value = dr.GetString(1);
Response.Cookies.Add(name); //添加用户类型到cookie
HttpCookie userType = new HttpCookie("usertype");
userType.Value = "";
Response.Cookies.Add(userType);

//添加用户口令到cookie
}
} // close the DataReader
dr.Close(); if (blnIsAuthenticated)
// FormsAuthentication.RedirectFromLoginPage(txtUsr.Value, chkPersist.Checked);
outMessage.InnerHtml = "<b>OK</b>";
else
outMessage.InnerHtml = "<b>Invalid credentials</b> please re-enter...";
}

}
}