web.config无法限定htm文件,只能限定aspx.
当访问到服务器的htm文件时,它却直接打开了,根本就没转向指定的登陆界面!访问其他的aspx文件却能正常转向.应该怎么处理?
web.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.web>
<authentication mode="Forms" >
<forms name=".iis-root" loginUrl="Default.aspx"/>
</authentication>
<authorization>
<deny users="?"/>
</authorization>
</system.web>
</configuration>
----------------------------------------------
Default.aspx
<html>
<head>
<title>无标题页</title>
</head>
<body>
<form id="form1" method="post" runat="server">
<asp:TextBox ID="TextBox1" runat="server"/>
<br><asp:Button ID="Button1" runat="server" Text="提交" OnClick="Button1_Click"/>
<br><asp:Label ID="Label1" runat="server" Text="asdasd" />
</form>
</body>
</html><script language="C#" runat="server">
void Button1_Click(object sender, System.EventArgs e)
{
if(TextBox1.Text=="110")
{
System.Web.Security.FormsAuthentication.SetAuthCookie(TextBox1.Text, false); Response.Redirect("data2.aspx");
}
else
{
Label1.Text="用户名错误,请重新输入";
}
}
</script>
当访问到服务器的htm文件时,它却直接打开了,根本就没转向指定的登陆界面!访问其他的aspx文件却能正常转向.应该怎么处理?
web.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.web>
<authentication mode="Forms" >
<forms name=".iis-root" loginUrl="Default.aspx"/>
</authentication>
<authorization>
<deny users="?"/>
</authorization>
</system.web>
</configuration>
----------------------------------------------
Default.aspx
<html>
<head>
<title>无标题页</title>
</head>
<body>
<form id="form1" method="post" runat="server">
<asp:TextBox ID="TextBox1" runat="server"/>
<br><asp:Button ID="Button1" runat="server" Text="提交" OnClick="Button1_Click"/>
<br><asp:Label ID="Label1" runat="server" Text="asdasd" />
</form>
</body>
</html><script language="C#" runat="server">
void Button1_Click(object sender, System.EventArgs e)
{
if(TextBox1.Text=="110")
{
System.Web.Security.FormsAuthentication.SetAuthCookie(TextBox1.Text, false); Response.Redirect("data2.aspx");
}
else
{
Label1.Text="用户名错误,请重新输入";
}
}
</script>
解决方案 »
- 这样的菜单效果用javascript或者jquery如何实现啊?
- 电子商务网站配送中心功能模块及其设计
- 数据库中提取并显示在页面的图片,控制大小问题。?
- 100分请教高手,顶着有分,url重写后,怎么知道真实的url和参数??????
- 在删除信息时,做一个询问??
- 大型网站的目录问题
- FreeTextbox 控件嵌入进IFrame框架
- !!!!!!!!!!!在51job和其他人才网上要asp.net好少呀,合同快到了,想换个环境都难呀!!!
- treeview点击链接后能触发JS吗?
- Asp.net源码最近更新列表附截图(11.11-11.30)
- 请问怎么做一个树形目录???(解决给分)
- datatable数据查找 删除
========
可行。
就像url rewriter
添加映射
2,或者把指向404的那些个页面改为指向一个aspx页面