作爲標題說明如何允許用戶使用他們在註冊時指定的電子郵件登錄。如何允許使用asp註冊組件通過電子郵件登錄
使用asp 3.5,登錄和註冊都是內置的visual studio。
也有一種方法來刪除祕密的問題和答案。
感謝
作爲標題說明如何允許用戶使用他們在註冊時指定的電子郵件登錄。如何允許使用asp註冊組件通過電子郵件登錄
使用asp 3.5,登錄和註冊都是內置的visual studio。
也有一種方法來刪除祕密的問題和答案。
感謝
我的簡單而有效的這種解決方法是做到以下幾點:
1-重命名的標籤用戶名字段電子郵件:(這樣用戶會看到它通過電子郵件,但它實際上是仍然是ASP.NET成員資格將保存的用戶名)。
2-通常保存我的入口沿側與任何額外的信息,我需要保存
3-現在我的用戶將被強制使用他們提供的電子郵件登錄
4-笑臉:)
謝謝你,一個簡單而簡單的方法 – Wahtever 2011-04-13 20:14:35
我認爲你正在尋找窗體身份驗證。谷歌有很多說明。或在這裏看到: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中創建一個身份驗證票證( cookie)代表用戶認證的會話。
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'布爾方法來包含驗證的邏輯。在你的情況下,你需要將他們的電子郵件地址存儲在某個地方,並將認證邏輯指向該源。
「還有一種方法可以刪除最喜歡的問題和答案。」什麼? – Earlz 2011-04-13 00:16:34
抱歉,事情混淆了。我的意思是祕密 – Wahtever 2011-04-13 09:23:53