Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4017452
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T09:51:45+00:00 2026-05-20T09:51:45+00:00

I am trying to edit and update a selected users details, following the tutorial

  • 0

I am trying to edit and update a selected users details, following the tutorial https://web.archive.org/web/20210306174425/https://www.4guysfromrolla.com/articles/052307-1.aspx

I get the following errors in the Error List in VS 2010:

Error 6 ‘Comment’ is not a member of
‘System.Security.Principal.IPrincipal’. C:\projects\FPOS_v2\FamilyAdmin\edit_user.aspx.vb 21 9 C:\projects\FPOS_v2\

Error 5 ‘Email’ is not a member of
‘System.Security.Principal.IPrincipal’. C:\projects\FPOS_v2\FamilyAdmin\edit_user.aspx.vb 20 9 C:\projects\FPOS_v2\

Error 2 ‘FamilyAdmin_edit_user.Private
Sub DeleteUser(sender As Object, e As
System.EventArgs)’ is not accessible
in this context because it is
‘Private’. C:\projects\FPOS_v2\FamilyAdmin\edit_user.aspx 140

Error 1 ‘FamilyAdmin_edit_user.Private
Sub UnlockUser(sender As Object, e As
System.EventArgs)’ is not accessible
in this context because it is
‘Private’. C:\projects\FPOS_v2\FamilyAdmin\edit_user.aspx 138

Error 7 ‘IsApproved’ is not a member
of
‘System.Security.Principal.IPrincipal’. C:\projects\FPOS_v2\FamilyAdmin\edit_user.aspx.vb 22 9 C:\projects\FPOS_v2\

Error 8 ‘UnlockUser’ is not a member
of
‘System.Security.Principal.IPrincipal’. C:\projects\FPOS_v2\FamilyAdmin\edit_user.aspx.vb 88 9 C:\projects\FPOS_v2\

Error 4 Property ‘User’ is
‘ReadOnly’. C:\projects\FPOS_v2\FamilyAdmin\edit_user.aspx.vb 11 9 C:\projects\FPOS_v2\

The code for the edit_user.aspx is:

<table class="webparts">
<tr>
    <th>User Information</th>
</tr>
<tr>
<td class="details" valign="top">

<h3>Roles:</h3>
<asp:CheckBoxList ID="UserRoles" runat="server" />

<h3>Main Info:</h3>
<asp:DetailsView AutoGenerateRows="False" DataSourceID="MemberData"
  ID="UserInfo" runat="server" OnItemUpdating="UserInfo_ItemUpdating"
  >

<Fields>
    <asp:BoundField DataField="UserName" HeaderText="User Name" ReadOnly="True" HeaderStyle-CssClass="detailheader" ItemStyle-CssClass="detailitem">
    </asp:BoundField>
    <asp:BoundField DataField="Email" HeaderText="Email" HeaderStyle-CssClass="detailheader" ItemStyle-CssClass="detailitem"></asp:BoundField>
    <asp:BoundField DataField="Comment" HeaderText="Comment" HeaderStyle-CssClass="detailheader" ItemStyle-CssClass="detailitem"></asp:BoundField>
    <asp:CheckBoxField DataField="IsApproved" HeaderText="Active User" HeaderStyle-CssClass="detailheader" ItemStyle-CssClass="detailitem" />
    <asp:CheckBoxField DataField="IsLockedOut" HeaderText="Is Locked Out" ReadOnly="true" HeaderStyle-CssClass="detailheader" ItemStyle-CssClass="detailitem" />

    <asp:CheckBoxField DataField="IsOnline" HeaderText="Is Online" ReadOnly="True" HeaderStyle-CssClass="detailheader" ItemStyle-CssClass="detailitem" />
    <asp:BoundField DataField="CreationDate" HeaderText="CreationDate" ReadOnly="True"
     HeaderStyle-CssClass="detailheader" ItemStyle-CssClass="detailitem"></asp:BoundField>
    <asp:BoundField DataField="LastActivityDate" HeaderText="LastActivityDate" ReadOnly="True" HeaderStyle-CssClass="detailheader" ItemStyle-CssClass="detailitem">
    </asp:BoundField>
    <asp:BoundField DataField="LastLoginDate" HeaderText="LastLoginDate" ReadOnly="True" HeaderStyle-CssClass="detailheader" ItemStyle-CssClass="detailitem">
    </asp:BoundField>
    <asp:BoundField DataField="LastLockoutDate" HeaderText="LastLockoutDate" ReadOnly="True" HeaderStyle-CssClass="detailheader" ItemStyle-CssClass="detailitem"></asp:BoundField>
    <asp:BoundField DataField="LastPasswordChangedDate" HeaderText="LastPasswordChangedDate"
    ReadOnly="True" HeaderStyle-CssClass="detailheader" ItemStyle-CssClass="detailitem"></asp:BoundField>
    <asp:CommandField ButtonType="button" ShowEditButton="true" EditText="Edit User Info" />
</Fields>
</asp:DetailsView>
<div class="alert" style="padding: 5px;">
<asp:Literal ID="UserUpdateMessage" runat="server">&nbsp;</asp:Literal>
</div>


<div style="text-align: right; width: 100%; margin: 20px 0px;">
<asp:Button ID="Button1" runat="server" Text="Unlock User" OnClick="UnlockUser" OnClientClick="return confirm('Click OK to unlock this user.')" />
&nbsp;&nbsp;&nbsp;
<asp:Button ID="Button2" runat="server" Text="Delete User" OnClick="DeleteUser" OnClientClick="return confirm('Are Your Sure?')" />
</div>


<asp:ObjectDataSource ID="MemberData" runat="server" DataObjectTypeName="System.Web.Security.MembershipUser" SelectMethod="GetUser" UpdateMethod="UpdateUser" TypeName="System.Web.Security.Membership">
    <SelectParameters>
        <asp:QueryStringParameter Name="username" QueryStringField="username" DefaultValue="zora" />
    </SelectParameters>
</asp:ObjectDataSource> 
</td>

</tr></table>

The code for the edit_user.aspx.vb is which is where I am getting the error:

Partial Class FamilyAdmin_edit_user
    Inherits System.Web.UI.Page

    Private username As String

    Private Sub Page_Load()
        username = Request.QueryString("username")
        If username Is Nothing OrElse username = "" Then
            Response.Redirect("users.aspx")
        End If
        User = Membership.GetUser(username)

        UserUpdateMessage.Text = ""
    End Sub

    Protected Sub UserInfo_ItemUpdating(ByVal sender As Object, ByVal e As DetailsViewUpdateEventArgs)
        'Need to handle the update manually because MembershipUser does not have a
        'parameterless constructor  

        User.Email = DirectCast(e.NewValues(0), String)
        User.Comment = DirectCast(e.NewValues(1), String)
        User.IsApproved = CBool(e.NewValues(2))

        Try
            ' Update user info:
            Membership.UpdateUser(User)

            ' Update user roles:
            UpdateUserRoles()

            UserUpdateMessage.Text = "Update Successful."

            e.Cancel = True
            UserInfo.ChangeMode(DetailsViewMode.[ReadOnly])
        Catch ex As Exception
            UserUpdateMessage.Text = "Update Failed: " + ex.Message

            e.Cancel = True
            UserInfo.ChangeMode(DetailsViewMode.[ReadOnly])
        End Try
    End Sub

    Private Sub Page_PreRender()
        ' Load the User Roles into checkboxes.
        UserRoles.DataSource = Roles.GetAllRoles()
        UserRoles.DataBind()

        ' Disable checkboxes if appropriate:
        If UserInfo.CurrentMode <> DetailsViewMode.Edit Then
            For Each checkbox As ListItem In UserRoles.Items
                checkbox.Enabled = False
            Next
        End If

        ' Bind these checkboxes to the User's own set of roles.
        Dim userRoles__1 As String() = Roles.GetRolesForUser(username)
        For Each role As String In userRoles__1
            Dim checkbox As ListItem = UserRoles.Items.FindByValue(role)
            checkbox.Selected = True
        Next
    End Sub

    Private Sub UpdateUserRoles()
        For Each rolebox As ListItem In UserRoles.Items
            If rolebox.Selected Then
                If Not Roles.IsUserInRole(username, rolebox.Text) Then
                    Roles.AddUserToRole(username, rolebox.Text)
                End If
            Else
                If Roles.IsUserInRole(username, rolebox.Text) Then
                    Roles.RemoveUserFromRole(username, rolebox.Text)
                End If
            End If
        Next
    End Sub

    Private Sub DeleteUser(ByVal sender As Object, ByVal e As EventArgs)
        'Membership.DeleteUser(username, false); // DC: My apps will NEVER delete the related data.
        Membership.DeleteUser(username, True)
        ' DC: except during testing, of course!
        Response.Redirect("manage_members.aspx")
    End Sub

    Private Sub UnlockUser(ByVal sender As Object, ByVal e As EventArgs)
        ' Dan Clem, added 5/30/2007 post-live upgrade.

        ' Unlock the user.
        User.UnlockUser()

        ' DataBind the GridView to reflect same.
        UserInfo.DataBind()
    End Sub

End Class

The problem is with the User. But I don’t know how to sort this as im new to all this.

Any help would be greatly appreciated..

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T09:51:46+00:00Added an answer on May 20, 2026 at 9:51 am

    Because you forgot to define MembershipUser i.e.

    Partial Class FamilyAdmin_edit_user
         Inherits System.Web.UI.Page      
    Private username As String      
    Dim User As MembershipUser
    
    Private Sub Page_Load()
    .....
    

    Currently it is considering User as in ‘System.Security.Principal.IPrincipal’ and not MembershipUser.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to edit the output joomla main_menu module so I can make a
I am trying to get the Edit with Vim context menu to open files
I'm trying to determine how to open/edit existing SQL Server Reporting Services (SSRS) 2005
I'm trying to convert an openGL [edit: card that I drew(?):) thx unwind]containing a
I'm trying to load a page that is basically an edit form inside a
I'm trying to single source a form page which can be in edit mode
Edit--@Uri correctly pointed out that this was an abuse of annotations; trying to actually
I am trying to update the Roles a specific group has in my application.
I have a C# application that I'm trying to get to update automatically via
Trying to setup an SSH server on Windows Server 2003. What are some good

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.