My requirement is to 1)create a role and add user to that particular role. 2)I have a directory Admin which contains a aspx page which can be access by admin only 3)so i want to redirect user to login page if he tries to access any of the aspx page into a folder.
to implement this
i have use Asp.net membership for creating a user and role and various functionality for making a login form. The question is each time i require to open asp.net configuration to create a new user and assigning that user to a particular role. if i deploy my website on live site. so how can i add user now.
i am listing my web config file
<configuration>
<connectionStrings>
<add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=true;Initial Catalog=Web24;" providerName="System.Data.SqlClient"/>
</connectionStrings>
<system.web>
<compilation debug="true" targetFramework="4.0"/>
<authentication mode="Forms">
<forms loginUrl="~/WebForm1.aspx" timeout="2880"/>
</authentication>
<membership>
<providers>
<clear/>
<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/"/>
</providers>
</membership>
<profile>
<providers>
<clear/>
<add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/"/>
</providers>
</profile>
<roleManager enabled="true">
<providers>
<clear/>
<add connectionStringName="ApplicationServices" applicationName="/" name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider"/>
<add applicationName="/" name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider"/>
</providers>
</roleManager>
</system.web>
<location path="Admin">
<system.web>
<authorization>
<deny users="?" />
<!--Deny all Anonymous (not logged in) users-->
<allow roles="Admin"/>
<!--Permit users in these roles-->
<deny users="*"/>
<!--Deny all users-->
</authorization>
</system.web>
</location>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
if it is not possible with Asp.net membership then what other method should i follow to cover my requirement.Thanks for any assistance.