Configuration ASP.Net Tutorial

Enable the remote server to accept remote configuration connections by executing the following command  from a command prompt:
aspnet_regiis -config+
To disable remove configuration connections, execute the following command:
aspnet_regiis -config-
The aspnet_regiis tool is located in the following path:
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe
<%@ Page Language="C#" %>
<%@ Import Namespace="System.Web.Configuration" %>
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        try
        {
            Configuration config = WebConfigurationManager.OpenMachineConfiguration(null, txtServer.Text, txtUserName.Text, txtPassword.Text);
            AuthenticationSection section = (AuthenticationSection)config.GetSection("system.web/authentication");
            lblAuthenticationMode.Text = section.Mode.ToString();
        }
        catch (Exception ex)
        {
            lblAuthenticationMode.Text = ex.Message;
        }
    }



    Show Config Remote


    
    

            id="lblServer"
        Text="Server:"
        AssociatedControlID="txtServer"
        Runat="server" />
    
            id="txtServer"
        Runat="server" />
    
            id="lblUserName"
        Text="User Name:"
        AssociatedControlID="txtUserName"
        Runat="server" />
    
            id="txtUserName"
        Runat="server" />
    
           id="lblPassword"
        Text="Password:"
        AssociatedControlID="txtPassword"
        Runat="server" />
    
             id="txtPassword"
        TextMode="Password"
        Runat="server" />
    
            id="btnSubmit"
        Text="Submit"
        OnClick="btnSubmit_Click"
        Runat="server" />
    
    Authentication Mode:
            id="lblAuthenticationMode"
        Runat="server" />