Response.Redirect(test.htm; test.htm页面能不能新开一个窗口显示啊!

nsi20141 2003-06-11 03:13:36
我在我的一个网页的表格当中加入下边这条语句,为了在这个表格中调用登陆页面,可是当输入用户名和密码点登陆按钮后(login.aspx 中用到了Response.Redirect("update_xinxi.aspx"); ) 结果update_xinxi.aspx页面只能在当前的这个表格中显示
我怎样让它新开一个窗口显示呢?


<IFRAME marginWidth="0" marginHeight="0" align = "center" src="login.aspx" frameBorder="0" noResize width="140" scrolling="no" height="140"></IFRAME>
...全文
46 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
ShiningstarHu 2003-06-11
  • 打赏
  • 举报
回复
这样试试:

<%
void ImageButton1_Click(Object sender, ImageClickEventArgs e) {
if (Page.IsValid) {
// 连接到本地计算机的search数据库
SqlConnection cn=new SqlConnection("server=localhost;initial catalog=search;uid=sa;password=sa");
// 打开连接
cn.Open();
// 构造SQL语句,该语句在qy_RegUsers表中检查用户名和密码是否正确
String strSQL="select * from qy_RegUsers where NickName='"+
nickname.Text+"' and Password='"+pwd.Text+"'";
// 创建Command对象
SqlCommand cm=new SqlCommand(strSQL,cn);
// 执行ExecuteReader()方法
SqlDataReader dr=cm.ExecuteReader();
if (dr.Read()) {

// 保存当前用户的登录名称
Session["UserName"]=dr["NickName"];
// 进入管理界面
%>
<script language=javascript>
window.Open('update_xinxi.aspx')
</script>
<%
}
else{
Message.Text="用户名或密码错误";

}

// 关闭连接
cn.Close();
}

}
%>
nsi20141 2003-06-11
  • 打赏
  • 举报
回复
更改后:出现下边的错误
编译器错误信息: CS1010: 常数中有换行符 行 32: Response.Write("</script>");
我的代码如下:
<%@ Page Language="C#" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.SqlClient" %>
<script runat="server">
void ImageButton1_Click(Object sender, ImageClickEventArgs e) {
if (Page.IsValid) {
// 连接到本地计算机的search数据库
SqlConnection cn=new SqlConnection("server=localhost;initial catalog=search;uid=sa;password=sa");
// 打开连接
cn.Open();
// 构造SQL语句,该语句在qy_RegUsers表中检查用户名和密码是否正确
String strSQL="select * from qy_RegUsers where NickName='"+
nickname.Text+"' and Password='"+pwd.Text+"'";
// 创建Command对象
SqlCommand cm=new SqlCommand(strSQL,cn);
// 执行ExecuteReader()方法
SqlDataReader dr=cm.ExecuteReader();
if (dr.Read()) {

// 保存当前用户的登录名称
Session["UserName"]=dr["NickName"];
// 进入管理界面

Response.Write("<script>");
Response.Write("Window.Open('update_xinxi.aspx');");
Response.Write("</script>");

}
else{
Message.Text="用户名或密码错误";

}

// 关闭连接
cn.Close();
}

}

</script>
ShiningstarHu 2003-06-11
  • 打赏
  • 举报
回复

<%
Response.Redirect("update_xinxi.aspx")
%>

改成

Response.Write "<script langugae=javascript>" & vbCrLf
Response.Write "window.open(""update_xinxi.aspx"","""","""");" & vbCrLf
Response.Write "</script>"

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧