Response.Write没有显示在标志上

时间:2015-01-02 21:08:14

标签: c# asp.net

如果我可以避免回复。写下会有什么选择?

有人可以告诉为什么这条回复讯息没有显示出来吗?它直到最近才使用。

DirectorySearcher objADSearcher = new DirectorySearcher(de);
de.AuthenticationType = AuthenticationTypes.Secure;

objADSearcher.SearchRoot = de;
objADSearcher.Filter = "(SAMAccountName=" + item + ")";
SearchResult results = objADSearcher.FindOne();
if (results.ToString() != "")
{
    int flags = Convert.ToInt32(results.Properties["userAccountControl"][0].ToString());
    //for reference results.Properties["userAccountControl"][0].ToString().Equals("514");

    if (Convert.ToBoolean(flags & 0x0002))
    {
        Response.Write("<script> alert ('" + "Account Disabled for more then 90 days, please call helpdesk at 1 xx.xx.xxx to activate your account" + "') </script>");
    }

1 个答案:

答案 0 :(得分:0)

使用后面代码中的Response.Write的替代方法是注册这样的javascript:

ScriptManager.RegisterStartupScript(this, this.GetType, "Alert", "alert('this is a test');", true);