| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 345 人关注过本帖
标题:.net webconfig location 配置问题
只看楼主 加入收藏
kankankan222
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2010-10-7
收藏
 问题点数:0 回复次数:0 
.net webconfig location 配置问题
<system.web>
  <authentication mode="Forms">
  <forms loginUrl="login.aspx" name=".ASPXFORMSAUTH"/>
  </authentication>
  <authorization>
  <allow users="*"/>
  </authorization>
  <compilation debug="true"/>
   
  </system.web>
  <location path="Default.aspx">
<system.web>
<authorization>
<deny users="?"/>
<allow roles="admin"/>
</authorization>
  </system.web>
  </location>

设置了default.aspx为起始页。运行 跳到了login.aspx页 输入帐号 登录后为什么可以跳到 default.aspx 。不是只有role为admin的才能进来吗。
login也代码是这样的。都弄了一天了,求大侠帮忙啊。
 protected void Logon_Click(object sender, EventArgs e)
  {
  if ((UserEmail.Text == "aa") && (UserPass.Text == "aa"))
  {
  MessageBox.Show("dengru");
  FormsAuthenticationTicket tickets = new FormsAuthenticationTicket(1,
  UserEmail.Text,
  DateTime.Now,
  DateTime.Now.AddMinutes(1),
  true,
  "user",
  FormsAuthentication.FormsCookiePath
  );
  string encTicket = FormsAuthentication.Encrypt(tickets);
  Response.Cookies.Add(new HttpCookie(FormsAuthentication.FormsCookieName, encTicket));

  Response.Redirect(FormsAuthentication.GetRedirectUrl(UserEmail.Text, true));
   
  }
  else
  {
  Msg.Text = "Invalid credentials. Please try again.";
  }
  }
搜索更多相关主题的帖子: 问题 admin 
2012-04-21 23:00
快速回复:.net webconfig location 配置问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.011081 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved