asp.net c# tutorials and examples code for beginners

How to change update another user profile in asp.net

How to change update another user profile in asp.net
Default.aspx
<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">
    protected void Button1_Click(object sender, System.EventArgs e) {
        ProfileCommon userProfile = Profile.GetProfile(TextBox1.Text.ToString());
        userProfile.Name = TextBox2.Text;
        userProfile.Age = TextBox3.Text;
        userProfile.Save();
        Label1.Text = "Profile updated...!<br /><br />";
        Label1.Text += "Profile read....<br />";
        Label1.Text += "Name: " + userProfile.Name;
        Label1.Text += "<br />Age: " + userProfile.Age;
    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>How to change update another user profile in asp.net</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <h2 style="color:Navy">asp.net Profile example: Update another user profile</h2>
        <asp:Label 
             ID="Label1" 
             runat="server" 
             Font-Size="Medium" 
             Font-Bold="true"
             ForeColor="SeaGreen"
             >
        </asp:Label>
        <br /><br />
        <asp:Label 
             ID="Label2" 
             runat="server" 
             Font-Bold="true"
             ForeColor="DodgerBlue"
             Text="User Name"
             >
        </asp:Label>
        <asp:TextBox 
             ID="TextBox1" 
             runat="server" 
             BackColor="Crimson" 
             ForeColor="AliceBlue"
             >
        </asp:TextBox>
        <br />
        <asp:Label 
             ID="Label3" 
             runat="server" 
             Font-Bold="true"
             ForeColor="HotPink"
             Text="Profile Name"
             >
        </asp:Label>
        <asp:TextBox 
             ID="TextBox2" 
             runat="server" 
             BackColor="DodgerBlue" 
             ForeColor="AliceBlue"
             >
        </asp:TextBox>
        <br />
        <asp:Label 
             ID="Label4" 
             runat="server" 
             Font-Bold="true"
             ForeColor="HotPink"
             Text="Profile Age"
             >
        </asp:Label>
        <asp:TextBox 
             ID="TextBox3" 
             runat="server" 
             BackColor="DodgerBlue" 
             ForeColor="AliceBlue"
             >
        </asp:TextBox>
        <br /><br />
        <asp:Button 
             ID="Button1" 
             runat="server" 
             Font-Bold="true" 
             ForeColor="DodgerBlue"
             Text="Update Profile"
             OnClick="Button1_Click"
             />
    </div>
    </form>
</body>
</html>
web.config [Modified Parts]
<authentication mode="Windows" />
<profile>
  <properties>
    <add name="Name"/>
    <add name="Age"/>
  </properties>
</profile>












Related asp.net example