方法一: 復制代碼 代碼如下:
string str1 = "0,1,2,3,4,5,6 ";
string[] str = str1.Split( ', ');
bool hasFlag=false;
foreach (string a in str)
{
if (a == "7 ")
{
hasFlag=true;
break;
}
}
if(hasFlag)
{ //執行當前頁 }
else
{ //跳轉 }
方法二 復制代碼 代碼如下:
string [] flag = adminuser.Flag.Split('/');
List<string> list = new List<string>(flag);
if (list.Contains("9"))
Response.Write("當前操作用戶"+adminuser.UserName.ToString());
else
Response.Write("<script>alert('您無權限進行此項操作');location.href='admin_main.aspx'</script>");