请问有没有NameValueCollection这个类的啊?在哪个名字空间啊?
为什么这个程序引用了System.IO就可以实现NameValueCollection coll;怎么回事??
<%@ Import namespace="System.IO" %>
<html>
<head>
<title>HTML表单举例!</title>
<script Language="C#" runat="server" >
void Page_Load()
{
NameValueCollection coll;
if(Request.HttpMethod == "GET")
{
coll = Request.QueryString;
}
else if(Request.HttpMethod == "POST")
{
coll = Request.Form;
}
else
{
Text1.Text = "未知的传送方法!";
return;
}
// Verify if the password is identical
if( coll["password"] != coll["repassword"] )
{
Text1.Text = "两次输入的密码不同,注册失败!";
return;
}
try
{
string filename = Request.PhysicalApplicationPath + "\\" + coll["name"] + ".txt";
StreamWriter writer = File.CreateText(filename);
writer.WriteLine("name={0}", coll["name"]);
writer.WriteLine("password={0}", coll["password"]);
writer.WriteLine("birthday={0}年{1}月", coll["year"], coll["month"]);
writer.WriteLine("description={0}", coll["description"]);
writer.Close();
}
catch(Exception e)
{
Text1.Text = e.ToString();
}
Text1.Text = coll["name"] + "注册成功!";
}
</script>
</head>
<body>
<asp:Label id="Text1" runat="server" />
</body>
</html>