I have a few users setup in the web.config of an asp.net site to handle authentication. Without getting into details I'm not using the full membership/role provider and would rather not have to implement it at the moment do to time constraints. However I do need the ability to assign a role to a user so that securityTrimming works on the sitemaps associated menus.
For now I just have a few users setup in the web.config (i use SHA1 in real config)
<authentication mode="Forms">
<forms name="Auth" loginUrl="~/login.aspx" defaultUrl="~/admin/default.aspx" requireSSL="true">
<credentials passwordFormat="Clear">
<user name="admin" password="test"/>
</credentials>
</forms>
</authentication>
Is it possible to also assign a Role to one of the users in the credentials section or elsewhere without setting up an actual role provider? Something similar to how I have the users setup above.
This is not possible to do via the web.config, you will need to setup the membership provider, but using the .exe to create the database tables, the whole process literally takes under 5 minutes to complete!
I've had the same "issue" a couple of times now, so I finally implemented a simple iRoleProvider implementation that uses web.config. Check it out on Codeplex, Web.Config Role Provider .
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With