我的 asp.net 应用程序部署在aaa
具有Windows Authentication
. 用户尝试使用域登录bbb
。它不拒绝登录提示窗口。访问 SQL 服务器时抛出错误。
Server Error in '/' Application.
Login failed for user 'bbb\user'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Login failed for user
'bbb\user'.
Source Error:
Line 7: username = username.Substring(pos + 1)
Line 8:
Line 9: Clients = (From c In SGAEntities.Dim_Client
Line 10: Where c.App_Users_Clients.Any(Function(userclient) userclient.App_Users.Username = username And userclient.App_Users.RecordStatus = 1 And userclient.Access_Level = 1)
Line 11: Select c).ToList()
Source File: error Line: 9
Stack Trace:
网页配置
<authentication mode="Windows"/>
<authorization>
<deny users = "?" />
</authorization>
<identity impersonate="true"/>
当他尝试使用不同的域登录时如何停止用户网站访问?
更新
按照朋友的建议,将 Impersonate 更改为false
. 得到不同的错误。
Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'.
说明:执行当前 Web 请求期间发生未处理的异常。请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。
异常详细信息:System.Data.SqlClient.SqlException:用户“NT AUTHORITY\ANONYMOUS LOGON”登录失败。
源错误:
第 7 行:username = username.Substring(pos + 1) 第 8 行:第 9 行:Clients = (From c In SGAEntities.Dim_Client 第 10 行:其中 c.App_Users_Clients.Any(Function(userclient) userclient.App_Users.Username = username And userclient.App_Users.RecordStatus = 1 和 userclient.Access_Level = 1) 第 11 行:选择 c).ToList()
数据库连接字符串是
<add name="Entities" connectionString="metadata=res://*/Data.csdl|res://*/Data.ssdl|res://*
/Data.msl;provider=System.Data.SqlClient;provider connection string='data
source=server;initial catalog=database;Trusted_Connection=Yes;multipleactiveresultsets=True;App=EntityFramework'" providerName="System.Data.EntityClient" />