1

ProfileCommon が Web アプリケーション プロジェクト (WAP) で使用できないことはわかっていますが、代わりに Web サイト タイプを使用しています。これをweb.configファイルに入れました

<system.web>
  <profile enabled="true">
    <properties>
      <add name="FirstName" type="System.String"/>
      <add name="LastName" type="System.String"/>
      <add name="Address" type="System.String"/>
      <add name="City" type="System.String"/>
      <add name="State" type="System.String"/>
      <add name="Zip" type="System.String"/>
      <add name="Email" type="System.String"/>
      <add name="Birthday" type="System.String"/>
      <add name="ProfilePicture" type="System.String"/>
      <add name="ProfilePictureThumb" type="System.String"/>
    </properties>
  </profile>
  <roleManager enabled="true"></roleManager>
</system.web>

そして、追加しようとすると

ProfileCommon profile = HttpContext.Current.Profile as ProfileCommon;

.cs ファイルへのステートメントを取得します

The type or namespace name 'ProfileCommon' could not be found (are you missing a using directiv or assembly reference)

私はインポートを使用しています

using System;
using System.Web;
using System.Web.Security;
using System.Web.Profile;
4

1 に答える 1

0

このブログ投稿が役に立ちます: VS2010 の WebProfile Builder と WAP

ProfileCommon動的クラスです。以下のコード行を使用して、そのインスタントを作成できます。

var profile = HttpContext.Current.Profile;

ここに画像の説明を入力

プロパティ値を設定する必要がある場合:

profile.SetPropertyValue("FirstName","testName");
于 2012-05-01T05:12:23.267 に答える