简体   繁体   English

LDAP身份验证和匿名用户使用相同的asp.net mvc页面

[英]The same asp.net mvc page for LDAP authenticated and anonymous users

I have some intranet asp.net mvc3 app ,which is available for both LDAP authenticated and anonymous users.All of them are using IE. 我有一些Intranet asp.net mvc3应用程序,可用于LDAP身份验证的用户和匿名用户。它们都使用IE。 One of the views should be available for both of them, depending on status some columns should be hidden,etc. 其中两个视图应可用,取决于状态,某些列应隐藏,等等。
I don't want anonymous users to receive popup authentication dialog,but can't see no way of solving problem.If I add Authorize() attribute ,it forces anonymous user to input user/password, if I remove this attribute everyone is treated as anonymous. 我不希望匿名用户收到弹出式身份验证对话框,但是看不到解决问题的方法。如果添加Authorize()属性,它将强制匿名用户输入用户名/密码,如果删除此属性,每个人都将得到处理作为匿名。
How can be this obstacle solved? 如何解决这个障碍?

In your controller check to see if the user is authenticated and perform actions based off that conclusion. 在控制器中,检查用户是否已通过身份验证,然后根据该结论执行操作。

if (User.Identity.IsAuthenticated){
//Handle Case

}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM