2012-11-22 152 views
3

我正在使用createUserWizard控件爲我的網站註冊用戶,但我也使用自己的表來存儲關於這些用戶的信息(地址,圖像,描述等)。會員未被識別

創建用戶時,我也想在自己的表中創建一個新實例。我想通過userID將我自己的錶鏈接到ASP.NET的用戶表。我嘗試從成員身份的createUserWizard中獲取此信息,但ASP無法識別成員身份。我忘了添加一些東西嗎?

這裏是我的代碼(代碼後面)

protected void CreateUserWizard1_CreatedUser(object sender, EventArgs e) 
{ 
    try 
    { 
     BLLorganisation BLLo = new BLLorganisation(); 
     Organisation o = new Organisation(); 
     TextBox t = new TextBox(); 
     t = (TextBox)(this.CreateUserWizard1.FindControl("UserName")); 
     o.organisation_name = t.Text; 
     o.fk_user_id = Membership.GetUser(CreateUserWizard1.UserName).ProviderUserKey.ToString(); 
     BLLo.insertOneOrganisation(o); 
    } 
    catch (Exception ex) 
    { 
     feedback.InnerHtml = ex.Message; 
     feedback.Style.Add("display", "block"); 
    } 
} 
+0

有什麼異常? – magnattic

+1

當你說它「不承認會員資格」時,你是否錯過了文件頂部的'使用System.Web.Security'? –

+0

另外,在web.config中發佈有關角色和成員資格的設置 –

回答

0

包括using System.Web.Security;