首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

Response.Write("<script>alert('')</script>"); 不起

2012-12-18 
Response.Write(scriptalert('')/script) 不起作用SqlConnection conn new SqlConnect

Response.Write("<script>alert('')</script>"); 不起作用
SqlConnection conn = new SqlConnection(ConfigurationManager.AppSettings["ConnectionString"]);
SqlCommand cmd = new SqlCommand("select * from userlogin where useremail='" + this.Login1.UserName + "' and pwd = '" + System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(this.Login1.Password.Trim(), "MD5") + "';", conn);

            try
            {
                conn.Open();
                SqlDataReader dr = cmd.ExecuteReader();
                if (dr.Read())
                {
                    //Session["userAuth"] = modeluser.Purview;
                    Session.Add("userName", null);
                    Session["userName"] = dr["username"];
                    Session["userID"] = dr["useremail"];
                    //将已验证身份的用户重定向回最初请求的 URL。
                    FormsAuthentication.RedirectFromLoginPage(this.Login1.UserName.Trim(), false);
                    if (Convert.ToInt32(dr["validate"]) == 1)
                    {
                         Response.Redirect(@"~/temp/MakeCourse.aspx", false);
                    }
                    else 
                    {
                        Response.Write("<script>alert('对不起,只有经过管理员审批才能制作!')</script>");
                        
                    }
                }
                else
                {                    


                    Response.Write("<script>alert('用户名或密码错误!')</script>");                               
                }                              
        }
        catch (System.Data.SqlClient.SqlException ex)
        {
            this.Login1.FailureText = ex.Message;
        }
        finally
        {
            conn.Close();
          
        }
如果用户名或者密码错误会弹出提示框,但是dr["validate"]) == 0的话,跟踪程序也执行了 else 
                    {
                        Response.Write("<script>alert('对不起,只有经过管理员审批才能制作!')</script>");
                        
                    }
可是为什么没有弹出提示框?
[最优解释]

引用:
27楼试验了,不行的


Response.Write("<script language='javascript'>");
Response.Write("alert('对不起只有经过管理员审批才能制作');");
Response.Write("</script>");

上面这个我刚试过了可行.
你试试Response.Write("对不起只有经过管理员审批才能制作");
看能不能在页面中显示出来.如果也不能显示,那就是你其它代码的问题了
[其他解释]
0
[其他解释]
结尾
Response.End()
[其他解释]
这样:Response.Write("<script language='javascript'>alert('对不起,只有经过管理员审批才能制作!')</script>");
或者这样:this.ClientScript.RegisterStartupScript(this.GetType(), "error", "<script>alert('对不起,只有经过管理员审批才能制作!')</script>");
试试呢
[其他解释]
HolyPlace
 和DoubleFrost说的都不行
[其他解释]
2楼正解
[其他解释]
引用:
这样:Response.Write("<script language='javascript'>alert('对不起,只有经过管理员审批才能制作!')</script>");
或者这样:this.ClientScript.RegisterStartupScript(this.GetType(), "error", "<script>alert('对不起,只有经过管理员审批才能制作!')</s……


赞同
[其他解释]
二楼的我测试了,不行啊!!!
------其他解决方案--------------------


ClientScript.RegisterClientScriptBlock(this.GetType(), "s", "alert('对不起,只有经过管理员审批才能制作!", true);这个也行
[其他解释]
所有的提示框都改成那种格式了么?
[其他解释]
调试一下,看看走没走else
[其他解释]
return

[其他解释]
是啊,把Response.Write("<script>alert('用户名或密码错误!')</script>");   改成 this.ClientScript.RegisterStartupScript(this.GetType(), "error", "<script>alert('用户名或密码错误!')</script>");   当输入错误密码能弹框,可是输入正确的账号密码,只是dr["validate"]) == 0的账户登录时,想弹出“对不起,只有经过管理员审批才能制作”,可是没反应
[其他解释]
跟踪调试了,走else那句了
[其他解释]
你1L的代码是整个方法的代码吗?
[其他解释]
Page.ClientScript.RegisterStartupScript(this.GetType(), "error", "<script>alert('用户名或密码错误!')</script>"); 
[其他解释]
1L是btnlogin_Click的代码
[其他解释]
关注,我的代码一直这样用的,有时起作用,有时不起作用
现在不用这个了 =.=
[其他解释]
把你的整个方法,连带方法名字贴上来,看看方便
[其他解释]

引用:
这样:Response.Write("<script language='javascript'>alert('对不起,只有经过管理员审批才能制作!')</script>");
或者这样:this.ClientScript.RegisterStartupScript(this.GetType(), "error", "<script>alert('对不起,只有经过管理员审批才能制作!')</sc……

    赞同!
[其他解释]
把所有的Response.Write都改了~并确保输入的账号和密码是正确的且dr["validate"]) == 0~也不提示么?不是吧。。。。
[其他解释]
你是有有使用了 UPDATEPANEL啊  !使用这个  System.Web.UI.ScriptManager.RegisterStartupScript(this.UpdatePanel1,this.GetType(),"click","alert('对不起,只有经过管理员审批才能制作!')",true);试试看

               
[其他解释]
登录按钮的事件:
 protected void btnlogin_Click(object sender, EventArgs e)
    {
SqlConnection conn = new SqlConnection(ConfigurationManager.AppSettings["ConnectionString"]);
SqlCommand cmd = new SqlCommand("select * from userlogin where useremail='" + this.Login1.UserName + "' and pwd = '" + System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(this.Login1.Password.Trim(), "MD5") + "';", conn);

  try
  {
  conn.Open();
  SqlDataReader dr = cmd.ExecuteReader();
  if (dr.Read())
  {
  //Session["userAuth"] = modeluser.Purview;
  Session.Add("userName", null);
  Session["userName"] = dr["username"];
  Session["userID"] = dr["useremail"];
  //将已验证身份的用户重定向回最初请求的 URL。
  FormsAuthentication.RedirectFromLoginPage(this.Login1.UserName.Trim(), false);


  if (Convert.ToInt32(dr["validate"]) == 1)
  {
  Response.Redirect(@"~/temp/MakeCourse.aspx", false);
  }
  else  
  {
  Response.Write("<script>alert('对不起,只有经过管理员审批才能制作!')</script>");
    
  }
  }
  else
  {   
  Response.Write("<script>alert('用户名或密码错误!')</script>");   
  }   
  }
  catch (System.Data.SqlClient.SqlException ex)
  {
  this.Login1.FailureText = ex.Message;
  }
  finally
  {
  conn.Close();
    
  }
如果用户名或者密码错误会弹出提示框,但是dr["validate"]) == 0的话,跟踪程序也执行了 else  
  {
  Response.Write("<script>alert('对不起,只有经过管理员审批才能制作!')</script>");
    
  }

    }
没有用UPDATEPANEL
[其他解释]
看看你的方法结尾有没有重定向的代码,我上次就是因为这个ALERT提示不出来
[其他解释]
就上边两处弹框,都改了,如果数据库把dr["validate"])改1能跳到那个MakeCourse.aspx,可是数据库改回dr["validate"])为0就是不弹框
[其他解释]
alert 后面的分号!
[其他解释]
后边没有redirect,分号有啥关系,没分号也不弹
[其他解释]
好蛋疼……但愿是;的问题……
[其他解释]
27楼试验了,不行的

[其他解释]


response.write("<script language='javascript'>");
response.write("alert('对不起只有经过管理员审批才能制作');");
response.write("</script>");
response.end;

[其他解释]
第一个if结束 return 应该可以
[其他解释]
把代码标准化下,比如js结束用“;”然后在试下,建议用this.ClientScript.RegisterStartupScript。
[其他解释]
#region 提示信息
 public static void ShowMessage(System.Web.UI.Page page,string msg)
    {
        ScriptManager.RegisterStartupScript(page,page.GetType(), "Message", string.Format("window.alert('{0}');", msg), true);
    }
    #endregion
[其他解释]
HTML的问题,要帖前台代码才能诊断!
[其他解释]
下边是html源码,分两部分贴出来:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head><title>
通用课程建设
</title>
<style type="text/css">
.style1 {
margin-top: 0px;
}
</style>
</head>
<body style="text-align:center; background-image:url('images/defaultback.jpg');">
    <form name="form1" method="post" action="Default.aspx" onsubmit="javascript:return WebForm_OnSubmit();" id="form1" style="height: 195px">


<div>
<input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" />
<input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" />
<input type="hidden" name="__gvGridView1__hidden" id="__gvGridView1__hidden" value="" />
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="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" />
</div>
[其他解释]
这么简单的问题,楼主你把生成的html(页面源代码)贴上来看下就知道什么原因了。

这肯定有html规范有问题。
[其他解释]
Response.Write("对不起只有经过管理员审批才能制作");
试验了,也显示不出来,怎么回事?郁闷了!
[其他解释]
</tr><tr style="color:#284775;background-color:White;">
<td>数据库</td><td>赵六</td><td>2010-5-5 12:24:22</td><td>2010-5-5 13:03:46</td><td><a href="3@qq.com/index.aspx?dir=3@qq.com&amp;course=数据库">3@qq.com</a></td>
</tr><tr style="color:#333333;background-color:#F7F6F3;">
<td>计算机系统结构</td><td>张玉</td><td>2010-5-5 12:24:45</td><td>2010-5-5 13:03:46</td><td><a href="4@qq.com/index.aspx?dir=4@qq.com&amp;course=计算机系统结构">4@qq.com</a></td>
</tr><tr style="color:#284775;background-color:White;">
<td>软件工程</td><td>李强</td><td>2010-5-5 12:25:14</td><td>2010-5-5 13:03:46</td><td><a href="5@qq.com/index.aspx?dir=5@qq.com&amp;course=软件工程">5@qq.com</a></td>
</tr><tr style="color:#333333;background-color:#F7F6F3;">


<td>ASP.NET程序设计</td><td>王伟</td><td>2010-5-5 12:29:10</td><td>2010-5-5 13:03:49</td><td><a href="6@qq.com/index.aspx?dir=6@qq.com&amp;course=ASP.NET程序设计">6@qq.com</a></td>
</tr><tr style="color:#284775;background-color:White;">
<td>操作系统</td><td>陈玉龙</td><td>2010-5-5 12:26:26</td><td>2010-5-5 12:52:56</td><td><a href="782878952@qq.com/index.aspx?dir=782878952@qq.com&amp;course=操作系统">782878952@qq.com</a></td>
</tr><tr style="color:#333333;background-color:#F7F6F3;">
<td>Java程序设计</td><td>张亮</td><td>2010-5-5 12:48:41</td><td>2010-5-5 13:03:49</td><td><a href="8@qq.com/index.aspx?dir=8@qq.com&amp;course=Java程序设计">8@qq.com</a></td>
</tr><tr align="center" style="color:White;background-color:#284775;">
<td colspan="5"><table border="0">
<tr>
<td><a onclick="javascript:__gvGridView1.callback(&quot;1
[其他解释]
0
[其他解释]
<script type="text/javascript">
//<![CDATA[
var theForm = document.forms['form1'];
if (!theForm) {
    theForm = document.form1;
}
function __doPostBack(eventTarget, eventArgument) {
    if (!theForm.onsubmit 
[其他解释]
 (theForm.onsubmit() != false)) {
        theForm.__EVENTTARGET.value = eventTarget;
        theForm.__EVENTARGUMENT.value = eventArgument;
        theForm.submit();
    }
}
//]]>
</script>
<script src="/tykc/WebResource.axd?d=TyKzKACEzwMb1Azn512VxQ2&amp;t=634080466840000000" type="text/javascript"></script>
<script src="/tykc/WebResource.axd?d=Ss6wZSRUwfdzGn-1W8nDl61H1q-zPpYfUPPwgZX67nQ1&amp;t=634080466840000000" type="text/javascript"></script>
<script src="/tykc/WebResource.axd?d=F4DIIvbGm4t6MdoP1oleDg2&amp;t=634080466840000000" type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
function WebForm_OnSubmit() {
if (typeof(ValidatorOnSubmit) == "function" && ValidatorOnSubmit() == false) return false;
return true;
}
//]]>
</script>
<div><input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWDgKQkaeQAgKUvNa1DwL666vYDAKC0q+kBgLc2cjwBQKiobGPAwK/ovegBQKljrCfBwK/ovegBQKxq/v9AgLW4PbhBQLmobDMDQL+wI//DQLM9PumD1AZDF5W6kUVAwI6hzeHomIQqpbA" />
</div><div style="position: relative;margin: 0 auto;width:100px;text-align: left; left: 0px; top: 0px; height: 202px;"><img src="images/toppic.png" width="1002" height="159" /><br />
<div style="position: absolute; width: 251px; height: 244px; z-index: 1; left: 4px; top: 208px" id="layer1">
<table id="Login1" cellspacing="0" cellpadding="0" border="0" style="width:64px;height:239px;font-size:0.8em;font-family:Verdana;color:#333333;border-width:1px;border-style:Solid;border-color:#B5C7DE;background-color:#EFF3FB;border-collapse:collapse;">


<tr>
<td>
<table cellspacing="0" cellpadding="4" border="0" style="border-collapse:collapse;">
<tr>
<td style="width: 297px">
<table cellpadding="0" border="0" style="height:229px; width:237px;">
<tr>
<td align="center" colspan="2" style="color:White;background-color:#507CD1;font-size:0.9em;font-weight:bold;">
登录</td>
</tr>
<tr>
<td align="right" style="width: 41px; height: 50px">
<label for="Login1_UserName" id="Login1_UserNameLabel">
Eamil:</label>
</td>
<td style="height: 50px">
<input name="Login1$UserName" type="text" id="Login1_UserName" style="font-size:0.8em;height:19px;width:96px;" />
                                        &nbsp;
                                        <span id="Login1_RegularExpressionValidator1" style="color:Red;visibility:hidden;">Email错误</span></td>
</tr>
<tr>
<td align="right" style="height: 49px; width: 41px;">
<label for="Login1_Password" id="Login1_PasswordLabel">
密码:</label>
</td>
<td style="height: 49px">
<input name="Login1$Password" type="password" id="Login1_Password" style="font-size:0.8em;height:19px;width:95px;" />&nbsp;
</td>
</tr>
<tr>
<td colspan="2">
<input id="Login1_RememberMe" type="checkbox" name="Login1$RememberMe" /><label for="Login1_RememberMe">下次记住我。</label>
</td>
</tr>
<tr>
<td align="center" colspan="2" style="color:Red;">

</td>
</tr>
<tr>
<td align="right" colspan="2">
<input type="submit" name="Login1$btnlogin" value="登录" onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(&quot;Login1$btnlogin&quot;, &quot;&quot;, true, &quot;&quot;, &quot;&quot;, false, false))" id="Login1_btnlogin" style="height:20px;width:73px;" />
<input type="submit" name="Login1$btnmodifypwd" value="修改密码" onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(&quot;Login1$btnmodifypwd&quot;, &quot;&quot;, true, &quot;&quot;, &quot;&quot;, false, false))" id="Login1_btnmodifypwd" style="height:21px;width:76px;" />
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<div style="position:absolute ; width: 248px; height: 390px; z-index: 2; left: 8px; top: 457px" id="layer2">


<img src="images/left.gif" height="380" class="style1" style="width: 242px" /></div>
<div style="position: absolute; width: 742px; height: 624px; z-index: 3; left: 264px; top: 221px; text-align: left; font-size: medium" id="layer3">
<div style="position: absolute; width: 739px; height: 41px; z-index: 1; left: 0px; top: 0px; text-align: center; font-size: xx-large" id="layer4">
<span id="Label1">最新课程浏览</span>
</div>
<br />
<br />
<div style="position: absolute ; width: 740px; height: 581px; z-index: 2; left: 0px; top: 38px" id="layer5">
                &nbsp;
                <div id="__gvGridView1__div">
<table cellspacing="0" cellpadding="4" border="0" id="GridView1" style="color:#333333;font-size:Small;height:70px;width:736px;border-collapse:collapse;">
<tr style="color:White;background-color:#5D7B9D;font-weight:bold;">
<th scope="col">课程名称</th><th scope="col">任课教师</th><th scope="col">申请时间</th><th scope="col">审核时间</th><th scope="col">网站地址</th>
</tr><tr style="color:#333333;background-color:#F7F6F3;">
<td>植物生物学</td><td>李四</td><td>2010-5-5 10:15:30</td><td>2010-5-5 13:03:46</td><td><a href="1@qq.com/index.aspx?dir=1@qq.com&amp;course=植物生物学">1@qq.com</a></td>

[其他解释]
/wFleMUXgcxpuvTxaU14hDSVsCQh0GY=
[其他解释]
/wFleMUXgcxpuvTxaU14hDSVsCQh0GY=
[其他解释]
&quot;); return false;" href="javascript:__doPostBack('GridView1','Page$Next')" style="color:White;">下页</a></td><td><a onclick="javascript:__gvGridView1.callback(&quot;1
[其他解释]
page.ClientScript.RegisterStartupScript
这样试下了。

[其他解释]
刚才这个else里边加了this.label2.text = "fadfs";调试lable值可以改变,可是页面label控件没有显示字符串,怎么回事?
[其他解释]
&quot;); return false;" href="javascript:__doPostBack('GridView1','Page$Last')" style="color:White;">末页</a></td>
</tr>
</table></td>
</tr>
</table>
</div>
                <span id="Label2" style="display:inline-block;width:141px;">Label</span></div>
</div>
<div style="position: absolute ; width: 351px; height: 20px; z-index: 6; left: 643px; top: 161px; background-repeat: repeat-x" id="layer6">
<a id="lkbdeclare" href="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(&quot;lkbdeclare&quot;, &quot;&quot;, true, &quot;&quot;, &quot;&quot;, false, true))" style="color:White;">网站申报</a>


<a id="lkbsearch" href="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(&quot;lkbsearch&quot;, &quot;&quot;, true, &quot;&quot;, &quot;&quot;, false, true))" style="color:White;">网站搜索</a>
<a id="lkbadminlogin" href="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(&quot;lkbadminlogin&quot;, &quot;&quot;, true, &quot;&quot;, &quot;&quot;, false, true))" style="color:White;">管理员登录</a>
            <a id="LinkButton1" href="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(&quot;LinkButton1&quot;, &quot;&quot;, true, &quot;&quot;, &quot;&quot;, false, true))" style="color:White;">学院首页</a></div>
<div style="position:absolute ; width: 1002px; height: 29px; z-index: 5; left: 0px; top: 158px; background-image: url('images/backimg.png')" id="layer7">
</div>
</div>

<script type="text/javascript">
//<![CDATA[
var Page_Validators =  new Array(document.getElementById("Login1_RegularExpressionValidator1"));
//]]>
</script>

<script type="text/javascript">
//<![CDATA[
var Login1_RegularExpressionValidator1 = document.all ? document.all["Login1_RegularExpressionValidator1"] : document.getElementById("Login1_RegularExpressionValidator1");
Login1_RegularExpressionValidator1.controltovalidate = "Login1_UserName";
Login1_RegularExpressionValidator1.errormessage = "Email错误";
Login1_RegularExpressionValidator1.evaluationfunction = "RegularExpressionValidatorEvaluateIsValid";
Login1_RegularExpressionValidator1.validationexpression = "\\w+([-+.\']\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*";
//]]>
</script>


<script type="text/javascript">
//<![CDATA[

var Page_ValidationActive = false;
if (typeof(ValidatorOnLoad) == "function") {
    ValidatorOnLoad();
}

function ValidatorOnSubmit() {
    if (Page_ValidationActive) {
        return ValidatorCommonOnSubmit();
    }
    else {
        return true;
    }
}
        
WebForm_InitCallback();
var __gvGridView1 = new GridView();
__gvGridView1.stateField = document.getElementById('__gvGridView1__hidden');
__gvGridView1.panelElement = document.getElementById('__gvGridView1__div');
__gvGridView1.pageIndex = 0;
__gvGridView1.sortExpression = "/wFleMUXgcxpuvTxaU14hDSVsCQh0GY=";
__gvGridView1.sortDirection = 0;
__gvGridView1.setStateField();
__gvGridView1.callback = function(arg) {
    WebForm_DoCallback('GridView1',__gvGridView1.getHiddenFieldContents(arg),GridView_OnCallback,__gvGridView1,null,false);
};//]]>
</script>
</form>

</body>
</html>

[其他解释]
   如果你使用了Ajax的话 就用下 19楼的代码

热点排行