开发者

ASP.NET profile deletion

We use the ASP.NET profile subsystem to associate key-value pairs of information with users.

I am implementing functionality for the deletion of users.

I have been using the ProfileManager.DeleteProfile(string userName) method, but I have noticed that this leaves a row in the aspnet_Users table in the aspnetdb database we use to store the profile information.

Clearly, I could manipulate the database directly, but I am reluctant to do so.

What is开发者_StackOverflow社区 the best way to ensure all information assocaited with a user is deleted from the aspnetdb?

PS: there is a tantalising Membership.DeleteUser(string userName, bool deleteEverything) method, but this returns a database connection error. A web.config issue?


Add a membership section to web.config, linked to a connection string containing valid credentials (here: "SqlServices"):

   <membership defaultProvider="SqlProvider" userIsOnlineTimeWindow="20">
      <providers>
        <remove name="AspNetSqlProvider" />
        <add name="SqlProvider"
          type="System.Web.Security.SqlMembershipProvider"
          connectionStringName="SqlServices"
          enablePasswordRetrieval="false"
          enablePasswordReset="true"
          requiresQuestionAndAnswer="true"
          passwordFormat="Hashed"
          applicationName="/" />
      </providers>
    </membership>

Ensure the aspnet_SchemaVersions table in the aspnetdb database contains the row:

membership 1 true

You may then use the membership api (Membership.DeleteUser).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜