?
Solved

Easy question regarding ProfileCommon asp.net 3.5

Posted on 2009-04-18
5
Medium Priority
?
2,782 Views
Last Modified: 2012-05-06
I am working in asp.net 3.5

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Drawing;
using System.Threading;
using System.Globalization;
using System.Web;
using System.Web.Profile;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Resources;
using log4net;
using System.Collections.Generic;
using DateDLL;

Error      6      The type or namespace name 'ProfileCommon' could not be found (are you missing a using directive or an assembly reference?)      C:\inetpub\wwwroot\OmegaLove\OmegaLove.Web\Controls\uxRegister.ascx.cs      61      25      OmegaLove.Web
Error      7      The name 'GetProfile' does not exist in the current context      C:\inetpub\wwwroot\OmegaLove\OmegaLove.Web\Controls\uxRegister.ascx.cs      61      49      OmegaLove.Web
=========================================================
my web.condif
<profile defaultProvider="OL_ProfileProvider">
      <providers>
        <add name="OL_ProfileProvider" connectionStringName="LocalSqlServer"  applicationName="/" type="System.Web.Profile.SqlProfileProvider"/>
      </providers>
      <properties>
        <group name="Personal">
          <add name="UserName" type="System.String"/>
          <add name="Password" type="System.String"/>
          <add name="Email" type="System.String"/>
          <add name="FirstName" type="System.String"/>
          <add name="LastName" type="System.String"/>
          <add name="DOB" type="System.DateTime"/>
          <add name="Age" type="System.Int32"/>
          <add name="Gender" type="System.String"/>
          <add name="Seeking" type="System.String"/>
          <add name="Country" type="System.String"/>
          <add name="Region" type="System.String"/>
          <add name="City" type="System.String"/>
          <add name="ZipCode" type="System.String"/>
          <add name="ConfirmationGUID" type="System.String"/>
          <add name="UserIP" type="System.String"/>
          <add name="SessionID" type="System.String"/>
        </group>
        <group name="Address">
          <add name="Country" type="System.String"/>
          <add name="Region" type="System.String"/>
          <add name="City" type="System.String"/>
          <add name="ZipCode" type="System.String"/>
        </group>
        <group name="Preferences">
          <add name="Theme" type="String" allowAnonymous="false"/>
          <add name="Culture" type="String" defaultValue="en-US"/>
        </group>
      </properties>
    </profile>



protected void imgRegister_Click(object sender, EventArgs e)
        {
            if ((CaptchaTextBox.Text == Session["CaptchaImageText"].ToString()) && Page.IsValid)
            {
                try
                {
                    MembershipCreateStatus status;
                    
                    MembershipUser user = Membership.CreateUser(txtUserName.Text, txtPassword.Text, txtMailFrom.Text, null, null, false, null, out status);
                   
                    if (MembershipCreateStatus.Success == status)
                    {
 
 
                        ProfileCommon profile = GetProfile(user.UserName);
                        Guid userId = (Guid)user.ProviderUserKey;
 
                        profile.Personal.UserName = txtUserName.Text;
                        profile.Personal.Password = txtPassword.Text;
                        profile.Personal.Email = txtMailFrom.Text;
                        profile.Personal.FirstName = txtFirstName.Text;
                        profile.Personal.LastName = txtLastName.Text;
                        profile.Personal.DOB = Convert.ToDateTime(DateDDL.Date, CultureInfo.InvariantCulture);
                        profile.Personal.Age = getAge(DateDDL.Date);
                        profile.Personal.Gender = ddlGender.SelectedValue;
                        profile.Personal.Seeking = ddlSeeking.SelectedValue;
                        profile.Personal.ConfirmationGUID = Guid.NewGuid().ToString("N");
                        profile.Personal.UserIP = Request.UserHostAddress;
                        profile.Personal.SessionID = Session.SessionID;
 
                        profile.Address.Country = ddlCountryRegister.SelectedValue;
                        profile.Address.Region = ddlRegion.SelectedValue;
                        profile.Address.City = ddlCity.SelectedValue;
                        profile.Address.ZipCode = txtZipCode.Text;
 
                        profile.Save();
 
                        WebMsgBox.Show("User created successfully!");
                        iUserID = txtUserName.Text;
 
                        string sData = ResourceEmail.NewMemberEmail;
                        sData = sData.Replace("[Name]", txtFirstName.Text.Trim());
                        sData = sData.Replace("[LINK]", "http://www.omegalove.com/Activate.aspx?ID=" + userId);
                        sData = sData.Replace("[UserName]", txtUserName.Text.Trim());
                        sData = sData.Replace("[Pwd]", txtPassword.Text.Trim());
                        SMTPManager.SendEmail("webmaster@omegalove.com", "OmegaLove", txtMailFrom.Text.Trim(),
                                              sData, "New Member Activation", false);
                        Session["UserID"] = iUserID;
                        Response.Redirect("Registered.aspx");
                    }
                    else
                    {
                        // first else block:
                        switch (status)
                        {
                            case MembershipCreateStatus.DuplicateUserName:
                                WebMsgBox.Show("There already exists a user with this username.");
                                break;
                            case MembershipCreateStatus.DuplicateEmail:
                                WebMsgBox.Show("There already exists a user with this email address.");
                                break;
                            case MembershipCreateStatus.DuplicateProviderUserKey:
                            case MembershipCreateStatus.InvalidAnswer:
                            case MembershipCreateStatus.InvalidEmail:
                            case MembershipCreateStatus.InvalidProviderUserKey:
                            case MembershipCreateStatus.InvalidQuestion:
                            case MembershipCreateStatus.InvalidUserName:
                                WebMsgBox.Show(string.Format("The {0} provided was invalid.", status.ToString().Substring(7)));
                                break;
                            default:
                                WebMsgBox.Show("There was an unknown error; the user account was NOT created.");
                                break;
                        }
                    }
                }
                catch (Exception ex)
                {
                    WebMsgBox.Show(ex.Message);
                }
            }
            else
            {
                WebMsgBox.Show("Invalid Access Code, try again.");
                CaptchaTextBox.Text = "";
                Session["CaptchaImageText"] = GenerateRandomCode();
            }
        }
========================================================================

Open in new window

0
Comment
Question by:mathieu_cupryk
  • 4
5 Comments
 
LVL 14

Accepted Solution

by:
amar31282 earned 1500 total points
ID: 24174966
0
 

Author Comment

by:mathieu_cupryk
ID: 24176488
amar, I am lost it looks like it does not see it when I went from a web application to a WAP.
<profile enabled="true" defaultProvider="OL_ProfileProvider">
      <providers>
        <add name="OL_ProfileProvider" connectionStringName="LocalSqlServer"  applicationName="/" type="System.Web.Profile.SqlProfileProvider"/>
      </providers>
      <properties>
        <group name="Personal">
          <add name="UserName" type="System.String"/>
          <add name="Password" type="System.String"/>
          <add name="Email" type="System.String"/>
          <add name="FirstName" type="System.String"/>
          <add name="LastName" type="System.String"/>
          <add name="DOB" type="System.DateTime"/>
          <add name="Age" type="System.Int32"/>
          <add name="Gender" type="System.String"/>
          <add name="Seeking" type="System.String"/>
          <add name="Country" type="System.String"/>
          <add name="Region" type="System.String"/>
          <add name="City" type="System.String"/>
          <add name="ZipCode" type="System.String"/>
          <add name="ConfirmationGUID" type="System.String"/>
          <add name="UserIP" type="System.String"/>
          <add name="SessionID" type="System.String"/>
        </group>
        <group name="Address">
          <add name="Country" type="System.String"/>
          <add name="Region" type="System.String"/>
          <add name="City" type="System.String"/>
          <add name="ZipCode" type="System.String"/>
        </group>
        <group name="Preferences">
          <add name="Theme" type="String" allowAnonymous="false"/>
          <add name="Culture" type="String" defaultValue="en-US"/>
        </group>
      </properties>
    </profile>
0
 

Author Comment

by:mathieu_cupryk
ID: 24176527
I also do not have an app_code for my wap.
0
 

Author Closing Comment

by:mathieu_cupryk
ID: 31571750
nice try but u are missing the point when going from 2005 to 2008
profilecommon...
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses
Course of the Month15 days, 2 hours left to enroll

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question