PDA

View Full Version : مشكل در ايجاد پروفايل براي كاربر در هنگام ثبت نام .



merlin_vista
شنبه 19 مرداد 1387, 18:52 عصر
سلام من در موقع ثبت نام كاربر ميخواهم براي او يك پروفايل درست كنم . ولي اين خطا را ميده :عصبانی++:(از كنترل CreateUserWizard استفاده نميكنم / )


Invalid column name 'PropertyNames'.<br>Invalid column name 'PropertyValuesString'.<br>Invalid column name 'PropertyValuesBinary'. body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;} p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px} b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px} H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red } H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon } pre {font-family:"Lucida Console";font-size: .9em} .marker {font-weight: bold; color: black;text-decoration: none;} .version {color: gray;} .error {margin-bottom: 10px;} .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; } Invalid column name 'PropertyNames'.
Invalid column name 'PropertyValuesString'.
Invalid column name 'PropertyValuesBinary'.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Invalid column name 'PropertyNames'.
Invalid column name 'PropertyValuesString'.
Invalid column name 'PropertyValuesBinary'.


Web.Config

<authentication mode="Forms">
<forms defaultUrl="~/User/Default.aspx" loginUrl="~/login.aspx" slidingExpiration="true" path="/" name=".aspnetau" timeout="60" protection="All" ></forms>
</authentication>

<membership defaultProvider="SqlProvider" userIsOnlineTimeWindow="20">
<providers>

<add name="SqlProvider"
type="System.Web.Security.SqlMembershipProvider"
connectionStringName="cstr"
enablePasswordRetrieval="false"
enablePasswordReset="true"
requiresQuestionAndAnswer="false"
minRequiredPasswordLength="1"
passwordFormat="Clear"
applicationName="appmem"
minRequiredNonalphanumericCharacters="0"

/>
</providers>


</membership>
<profile defaultProvider="SqlProvider">
<providers>
<clear />
<add name="SqlProvider"
type="System.Web.Profile.SqlProfileProvider"
connectionStringName="cstr" />
</providers>

<properties>
<add name="name" type="string" />
<add name="famil" type="string"/>
<add name="mobile" type="string" />
</properties>
</profile>

دكمه ثبت :‌

Membership.CreateUser(this.txt_c_username.Text, this.txt_c_pass.Text, this.txt_c_email.Text);
Roles.AddUserToRole(this.txt_c_username.Text, "user");
ProfileCommon p = (ProfileCommon)ProfileCommon.Create(this.txt_c_use rname.Text);
p.SetPropertyValue("name", "مهرداد");
p.SetPropertyValue("famil", "قاسمي");
p.SetPropertyValue("mobile", "3465346");
p.Save();

قسمت هاي ديگه درست كار ميده . ولي قسمت پروفايل خطا ميده . :متفکر::افسرده:

mostafa_sgh
شنبه 19 مرداد 1387, 19:38 عصر
سلام دوست عزیز

این طور که از این خطا معلومه مشکلتون از Database.

اول از همه مطمئن شید داخل Database تون جدول aspnet_Profile وجود داره یا نه !

اگه وجود داشت مطمئن شید که فیلدهای ( PropertyNames و PropertyValuesString و PropertyValuesBinary ) توش هست یا نه .

اینا رو بررسی کنید تا ادامه ....

salehbagheri
شنبه 19 مرداد 1387, 20:21 عصر
<profile defaultProvider="SqlProvider">
<providers>
<clear />
<add name="SqlProvider"
type="System.Web.Profile.SqlProfileProvider"
connectionStringName="cstr" />
</providers>

<properties>
<add name="name" type="string" />
<add name="famil" type="string"/>
<add name="mobile" type="string" />
</properties>
</profile>


در كد بالا فكر كنم بايد قسمت <Provider> را حذف كني!