Вопрос

I am using the createUserWizard control to register the users for my website, but I also use my own table to store information (address, image, description, ...) about these users.

When creating a user, I also want to create a new instance in my own table. I want to link my own table to ASP.NET's user table via the userID. I tried grabbing this from the createUserWizard with Membership, but ASP doesn't recognize membership. Am I forgetting to add something?

Here's my code (code behind)

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");
    }
}
Это было полезно?

Решение

Include using System.Web.Security;

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top