2012-05-30 4 views
4

.NET의 멤버 자격 및 역할과 함께 제공되는 프로필을 사용하는 방법을 배우고 있습니다.익명 프로필을 검색하는 방법

//Q1. Does it mean I set auth manually when loading user, or create it if not already exists? 
//Or am I meant to get the isauth value from somewhere and pass it in? 
var currentUserProfile = ProfileBase.Create(Membership.GetUser().UserName, isauth); 
var anyUserProfile = ProfileBase.Create(strNewUser, isauth); 
//isauth: true to indicate the user is authenticated; 
//  false to indicate the user is anonymous. 

그리고 값을 얻을 :

//Q2. Are res1 and res2 below reflecting the same thing? 
//Gets a value that indicates whether the user has been authenticated 
bool res1 = HttpContext.Current.User.Identity.IsAuthenticated; 
//Gets a value indicating whether the user profile is for an anonymous user 
bool res2 = HttpContext.Current.Profile.IsAnonymous; 

나는 각 익명/인증의 관계에 대한 혼란 스러워요을 값을 설정하는 체인의 상단입니다 그러나, 나는 확실하지 않다 그들의. 어느 것이 사용자를 인증 또는 익명으로 설정/설정하는 올바른 방법입니까? 내 목표는 익명 사용자와 인증 된 사용자가 프로필을 가질 수있게하는 것입니다.

답변

2

res1res2의 값은 IIS 구성의 설정에 따라 다릅니다. 익명 모드에서 IIS6에서이 코드를 실행하면
당신이 같은 더 자세한 내용을 얻을 것이다 :

당신은 사용자 계정 CodeProject의에서

에 익명의 정체성을 결합하는 IIS에서 "익명 액세스"를 활성화 할 수 있습니다 아래에 나와 있습니다. 다음과 같이
http://www.codeproject.com/Articles/98950/ASP-NET-authentication-and-authorization

IIS7에서는 보안 탐색 할 수 있습니다 >> 인증 : enter image description here

것은 asp.net 인증 및 authorizaion에 다음 문서를 살펴 보자

enter image description here

enter image description here

+0

IIS6 se ttings, 아닌가요? 매우 가능성이있는 @Tom은 II7을 사용합니다. – abatishchev

+0

님이 2 개의 사진을 더 보았습니다. –

관련 문제