How to create and read Profile Group in ASP.NET

Step-1: Add this code into web.config file

<?xml version="1.0"?>

  For more information on how to configure your ASP.NET application, please visit


      <authentication mode="Windows" />
          <group name ="AuthorInfo">
            <add name="AuthorName"/>
            <add name ="age"/>
            <add name="rights"/>

          <group name ="EditorInfo">

            <add name ="EditorName"/>
            <add name ="EditorMail"/>
            <add name ="Editorrights"/>
        <compilation debug="false" targetFramework="4.0" />


Step-2: Add this code into .aspx file
<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

<script runat="server">  
    protected void Page_Load(object sender, System.EventArgs e)  
        // Author Information
        Profile.AuthorInfo.AuthorName = "Rhett Butler";
        Profile.AuthorInfo.age = "30";
        Profile.AuthorInfo.rights = "Article writing";
        // Editor Information

        Profile.EditorInfo.EditorName = "Jacob Lefore";
        Profile.EditorInfo.EditorMail = "";
        Profile.EditorInfo.Editorrights = "full rights";

    protected void Button1_Click(object sender, EventArgs e)
        Label1.Text += "<b>Author Information</b><br/>";
        Label1.Text += Profile.AuthorInfo.AuthorName+"<br/>";
        Label1.Text += Profile.AuthorInfo.age + "<br/>";
        Label1.Text += Profile.AuthorInfo.rights + "<br/>";
        Label1.Text += "<b>Editor Information</b><br/>";
        Label1.Text += Profile.EditorInfo.EditorName + "<br/>";
        Label1.Text += Profile.EditorInfo.EditorMail  + "<br/>";
        Label1.Text += Profile.EditorInfo.Editorrights + "<br/>";
<html xmlns="">  
<head id="Head1" runat="server">  
    <title>Get Lastupdated Date</title>  
    <form id="form1" runat="server">  
        <h2>Create user Group</h2>
        <asp:Label ID="Label1" runat="server" Text=""></asp:Label>
        <br />
        <br />
        <asp:Button ID="Button1" runat="server" Text="Get user Group" 
            Width="169px" onclick="Button1_Click" />
        <br /><br />  

Code Generate the following output

How to create and read Profile Group in ASP.NET

How to create and read Profile Group in ASP.NET How to create and read Profile Group in ASP.NET Reviewed by Jacob Lefore on January 14, 2014 Rating: 5

No comments