Logon & credentials issue in ASP.NET
Hi I am using asp.net. My requirement is as follows
The user logs in to his/her system using his network credentials. After successfully logging into the system he opens the home page of the application like www.xyz.com/Index.aspx. Since he is not authorized he is redirected to www.xyz.com/logon.aspx
But the crux here is开发者_如何学C he uses the same user ID & password which he used earlier to log in to the system.Thus he has to login twice. I want that once the user successfully logs into the system he should be able to directly open the www.xyz.com/Index.aspx & not asked to login again
We are using IIS to host our application. The pages are developed on dot net framework 2.0 & developed using Visual Studio 2005
- Configure IIS to use Windows authentication on the virtual directory, and turn off all the other authentication types.
- Remove your login page, you don't need one.
Put this in your
web.config
file in the<system.web>
section:<authentication mode="Windows"/> <authorization> <deny users="?"/> </authorization>
Use
User.Identity
to get the user'sWindowsIdentity
in a web page.
EDIT: ASP.NET supports three authentication providers out of the box: Forms
, Passport
and Windows
. If you want something else then you'll have to implement it from scratch. A quick Google search turned up this Custom Authentication Provider how-to, which might give you some pointers.
精彩评论