<authentication mode="Windows" /> <profile> <properties> <add name="Name"/> <add name="Country"/> </properties> </profile>
<%@ 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 Page_Load(object sender, System.EventArgs e) { if(!this.IsPostBack) { Profile.Name = "Jenny Jones"; Profile.Country = "Rome"; Label1.Text = "Profile data<br />"; Label1.Text += "<i>Name: " + Profile.Name; Label1.Text += "<br />Country: " + Profile.Country+ "</i>"; } } protected void Button1_Click(object sender, System.EventArgs e) { Profile.Name = TextBox1.Text.ToString(); Profile.Country = TextBox2.Text.ToString(); Label1.ForeColor = System.Drawing.Color.HotPink; Label1.Text = "Profile data updated successfully<br />"; Label1.Text += "<i>Name: " + Profile.Name; Label1.Text += "<br />Country: " + Profile.Country + "</i>"; } </script> <html xmlns="http://www.w3.org/1999/xhtml"> <head id="Head1" runat="server"> <title>How to update profile in asp.net (overwrite, modify user profile data)</title> </head> <body> <form id="form1" runat="server"> <div> <h2 style="color:Navy">asp.net Profile example: Update Profile</h2> <asp:Label ID="Label1" runat="server" Font-Size="Large" Font-Bold="true" ForeColor="SeaGreen" > </asp:Label> <br /><br /> <asp:Label ID="Label2" runat="server" Font-Bold="true" ForeColor="Navy" Text="Name" > </asp:Label> <asp:TextBox ID="TextBox1" runat="server" BackColor="Crimson" ForeColor="Snow" > </asp:TextBox> <br /> <asp:Label ID="Label3" runat="server" Font-Bold="true" ForeColor="Navy" Text="Country" > </asp:Label> <asp:TextBox ID="TextBox2" runat="server" BackColor="Crimson" ForeColor="Snow" > </asp:TextBox> <br /> <asp:Button ID="Button1" runat="server" Font-Bold="true" ForeColor="SeaGreen" Text="Update Profile" OnClick="Button1_Click" /> </div> </form> </body> </html>
Life is a Race Thanks & Regards By Sabari Mahesh P M
<profile> <properties> <add name="Name" allowAnonymous="true" /> <add name="Age" allowAnonymous="true" type="System.Int16"/> </properties> </profile>
------------------------------------------------ Learn throughout life
Regards Sekar.c
Login to post response