首页 新闻 赞助 找找看

Windows 2008 R2,64位 Oracle 11G,角色验证去连接sql serve

0
悬赏园豆:30 [已解决问题] 解决于 2011-10-28 08:37

登陆都没问题,到首页进去的时候,由于启用了窗体验证。。。。

出现 程序竟然自动去连接 Sql Server  

在与 SQL Server 建立连接时出现与网络相关的或特定于实例的错误。未找到或无法访问服务器。请验证实例名称是否正确并且 SQL Server 已配置为允许远程连接。 (provider: 命名管道提供程序, error: 40 - 无法打开到 SQL Server 的连接) 


出现错误地方是: System.Web.Security.RolePrincipal.IsInRole(String role)

IIS7会自动去连接Sql Server?

Web.Config
  <authentication mode="Forms">
  <forms loginUrl="login.aspx" timeout="720" />
  </authentication>

调用的代码:

public static bool IsInRoles(String roles)
{



HttpContext context
= HttpContext.Current;

foreach (String role in roles.Split( new char[] {';'} ))
{

if (role != "" && role != null && ((role == "0") || (context.User != null && context.User.IsInRole(role)))) //所有用户
{
return true;
}
}

return false;

}

 

四神的主页 四神 | 初学一级 | 园豆:6
提问于:2010-12-17 17:20
< >
分享
最佳答案
0

用asp.net自带的登陆控件了?

收获园豆:30
Astar | 高人七级 |园豆:40805 | 2010-12-20 16:09
没有用自带的登陆控件。。在2003下就没有问题。。。
四神 | 园豆:6 (初学一级) | 2010-12-21 10:52
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册