Search

Monday, January 13, 2014
0 comments

ProfileManager.DeleteProfile method delete profile in asp.net example

8:45 PMMonday, January 13, 2014
Step-1: Add this code in web.config file
<configuration>

    <system.web>
      <authentication mode="Windows" />
      <profile>
        <properties>
          <add name="UserName"/>
        </properties>
      </profile>
        <compilation debug="false" targetFramework="4.0" />
    </system.web>

</configuration>

Step-2: Add this code into your .aspx page

<%@ 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(!Page.IsPostBack)  
        {
            Profile.UserName = "Jacob Lefore";
            Profile.Save();
            Label1.Text = "Current User:" + Profile.UserName;  
        }  
    }  
  

    

    protected void DelteProfile(object sender, EventArgs e)
    {
        ProfileManager.DeleteProfile(User.Identity.Name);
        Profile.Save();
        Label1.Text = "Profile Deleted";

    }
</script>  
  
<html xmlns="http://www.w3.org/1999/xhtml">  
<head id="Head1" runat="server">  
    <title>Delete Users Profile</title>  
</head>  
<body>  
    <form id="form1" runat="server">  
    <div>  
        <h2>Delete User Profile</h2>
        <asp:Label ID="Label1" runat="server" Text=""></asp:Label>
        <br />
        <br />
        <asp:Button ID="Button1" runat="server" Text="Delete User Profile" 
            Width="169px" onclick="DelteProfile" />
        <br /><br />  
    </div>  
    </form>  
</body>  
</html>
Code generate the following output
ProfileManager.DeleteProfile method delete profile in asp.net example
ProfileManager.DeleteProfile method delete profile in asp.net example
ProfileManager.DeleteProfile method delete profile in asp.net example
ProfileManager.DeleteProfile method delete profile in asp.net example





Protected by Copyscape Online Copyright Protection Software

0 comments :

Post a Comment

 
Toggle Footer
Top