Windows身份验证的ASP.NET MVC [英] Windows Authentication with ASP.NET MVC

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

问题描述

我已经建立了一个自定义登录系统,我的asp.net MVC 1.0的Web应用程序,因为我存储大量用户数据的每个用户(我决定不要试图为Windows身份验证添加自定义表由于这一点)。登录系统基本使用SQL Server(2005或2008)和我自己的数据库和表结构,这是pretty标准。 A的用户表的唯一ID,用户名和密码散列这是与用户相关的数据我的其他表。

I've built a custom login system for my asp.net mvc 1.0 web application as I store large amounts of user data for each user (I decided against trying to add custom tables for the windows authentication due to this). The login system basically uses SQL Server (2005 or 2008) and my own database and table structure which is pretty standard. A users table with an unique id, username and hashed password which is linked to my other tables of user related data.

我的问题是,我怎么能配合我的系统使用Windows身份验证登录。我想允许管理员为用户(在我的系统中定义)选择Windows身份验证登录,也许一个值添加到我的自定义表的东西,我可以用它来验证他们的身份?

My question is, how can I tie my system to use Windows Authentication logins. I would like to allow the administrator to for a user (as defined in my system) select a Windows Authentication login and perhaps add a value to something in my custom table that I can use to authenticate them?

问题可能是措辞错误,我可能误会了Windows身份验证是如何工作的,但我想提供我的web应用程序的选项。

The question is probably phrased wrong and I might have misunderstood how Windows Authentication works but I would like to offer the option in my web application.

推荐答案

如果您对您的网站启用了Windows身份验证,那么你应该能够使用User.Identity.Name获得的目前他们NT / Active Directory用户名登录用户,并匹配到你的用户表中的列。

If you have Windows Auth enabled on your site then you should be able to use User.Identity.Name to get their NT/Active Directory user name of the currently logged in user, and match that to a column in your users table.

这篇关于Windows身份验证的ASP.NET MVC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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