表单身份验证不起作用 [英] Forms Authentication not working

查看:67
本文介绍了表单身份验证不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在ASP.NET应用程序中制作安全模块.
login.aspx.cs 页面中,我使用以下代码:

I am making security module in ASP.NET application.
In login.aspx.cs page I use follow code:

protected void DoLogin(object sender, EventArgs e)
{
   if (uname.Text == "snap" && pw.Text == "dragon")
   {
     FormsAuthentication.RedirectFromLoginPage(uname.Text, false);
   }
   BadLog.Text = "Check your username and password. Not logged in.";
  }
}


在欢迎页面中,我只是在身体标签上显示欢迎信息.

现在,当我将Welcome.aspx页面设置为启动时,它必须跳入登录页面作为安全区域.但是问题是它显示了欢迎页面.无需登录.请帮忙.

在web.config中,我使用:
<身份验证模式=表单">
形式defaultUrl ="Login.aspx"/>
</authentication>


In welcome page I am just showing welcome messege on body tag.

Now I want when I make my Welcome.aspx page as startup it have to jump on login page as a security region. but problem is that it showing welcome page. without login. Please help.

In web.config I use:
<authentication mode ="Forms">
forms defaultUrl ="Login.aspx"/>
</authentication>

推荐答案

看看这些:
如何:实现简单表单身份验证 [说明:ASP.NET 2.0中的表单身份验证 [在ASP.NET中使用表单身份验证-第1部分 [
Have a look at these:
How to: Implement Simple Forms Authentication[^]
Explained: Forms Authentication in ASP.NET 2.0[^]
Using Forms Authentication in ASP.NET - Part 1[^]
Check for correct config setting and implementation.


这篇关于表单身份验证不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆