错误6嵌入的语句不能是声明或标记语句string,怎么办?
protected void Button1_Click(object sender, EventArgs e)
{
if (RadioButtonList1.SelectedValue != "")
{
if(Request.Cookies["ip"]!=null)
string newip=Request.Cookies["ip"].Value;
if(newip==Request.UserHostAddress)
Response.Write("<script>alert('你已经投票!')</script>");
return;
int selectvalue = Convert.ToInt32(RadioButtonList1.SelectedValue);
switch (selectvalue)
{
case 1:
read2write(1);
break;
case 2:
read2write(2);
break;
case 3:
read2write(3);
break;
case 4:
read2write(4);
break;
}
}
}
button
------解决方案--------------------
string newip = string.Empty;
if(Request.Cookies["ip"]!=null)
newip=Request.Cookies["ip"].Value;