try
{
string con=ConfigurationSettings.AppSettings["dsn"];
SqlConnection myConnection=new SqlConnection(con);
myConnection.Open();
string strCmd="select count(*) from webnetuser where username=@username and password=@password";
SqlCommand myCommand=new SqlCommand(strCmd,myConnection);
    myCommand.Parameters.Add("@username",SqlDbType.NChar,10);
myCommand.Parameters.Add("@password",SqlDbType.NChar,10);
                myCommand.Parameters["@username"].Value=TextBox1.Text;
                myCommand.Parameters["@password"].Value=TextBox2.Text;
int n=(int)myCommand.ExecuteScalar();

if (n!=0)
{
                  
HttpCookie cookie = new HttpCookie["username"];
cookie.Value = TextBox1.Text.ToString();
Response.AppendCookie(cookie);
myCommand.Connection.Close();
Response.Redirect("news.aspx");
}编译时HttpCookie cookie = new HttpCookie["username"];此句抱错,E:\webxp\ycjyzx\login.aspx.cs(74): 无法将类型“string”隐式转换为“int”
E:\webxp\ycjyzx\login.aspx.cs(74): 无法将类型“System.Web.HttpCookie[]”隐式转换为“System.Web.HttpCookie”
如何解决?