2011-04-12 1 views
1

제목은 사용자가 등록시 지정한 이메일을 사용하여 로그인 할 수있는 방법을 말합니다.asp 가입 구성 요소를 사용하여 이메일로 로그인 할 수있는 방법

asp 3.5를 사용하면 로그인과 가입이 모두 내장 된 Visual Studio입니다.

또한 비밀 질문 및 답변을 제거하는 방법이 있습니다.

덕분에

+0

"또한 좋아하는 질문과 답변을 제거 할 수있는 방법이 있습니다." 뭐? – Earlz

+0

죄송합니다. 나는 비밀을 의미했다 – Wahtever

답변

0

이에 대한 나의 간단하고 효과적인 해결 할 수있는 다음 :

1 - 레이블의 이름을 변경 이름 필드 이메일 로 (그래서 사용자는 이메일로 볼 수 있지만 실제로입니다 여전히 ASP.NET 멤버쉽이 저장할 사용자 이름).

2 지금

3을 저장해야하는 추가 정보와 측면을 따라 일반적으로 내 항목을 저장 내 사용자들은 제공되는 이메일을 사용하여 로그인을 강요 당할 것이다

3- 미소 :)

+0

간단하고 쉬운 방법, 고마워. – Wahtever

0

난 당신이 폼 인증을 찾고 있습니다 생각합니다. Google에는 많은 지침이 있습니다. 또는 여기 참조 : http://msdn.microsoft.com/en-us/library/system.web.security.formsauthentication.aspx

당신은 당신의 인증 로직 컨트롤의 로그인 클릭 이벤트를 연결할 필요가

protected void Login_Click(object sender, EventArgs e) 
    { 
     // your logic here 
    } 

또한 같은 뭔가 인증 티켓을 만들 Global.asax.cs에 가야 다음 (쿠키)로 구성됩니다.

protected void Application_AuthenticateRequest(object sender, EventArgs e) 
    { 
     String cookieName = FormsAuthentication.FormsCookieName; 
     HttpCookie authCookie = Context.Request.Cookies[cookieName]; 

     if (null == authCookie) 
     {//There is no authentication cookie. 
      return; 
     } 

     FormsAuthenticationTicket authTicket = null; 

     try 
     { 
      authTicket = FormsAuthentication.Decrypt(authCookie.Value); 
     } 
     catch (Exception ex) 
     { 
      //Write the exception to the Event Log. 
      return; 
     } 

     if (null == authTicket) 
     {//Cookie failed to decrypt. 
      return; 
     } 

     //When the ticket was created, the UserData property was assigned a 
     //pipe-delimited string of group names. 
     String[] groups = authTicket.UserData.Split(new char[] { '|' }); 

     //Create an Identity. 
     GenericIdentity id = new GenericIdentity(authTicket.Name, "LdapAuthentication"); 

     //This principal flows throughout the request. 
     GenericPrincipal principal = new GenericPrincipal(id, groups); 

     Context.User = principal; 
    } 

또한 인증 로직을 포함하려면 'IsAuthenticted'부울 메서드가 필요합니다. 귀하의 경우 전자 메일 주소를 어딘가에 저장하고 인증 로직을 해당 소스에 연결해야합니다.

관련 문제