I use this codes for Role Authorization on my ASP.NET MVC 4 Internet Application..
@if (Roles.IsUserInRole("RolunAdi"))
{
<a href="#">Test</a>
}
It works normally but sometimes I have an error.. It is on the this image..
http://forum.yazgelistir.com/JS/HTMLEditor/Image.aspx?id=593&siteid=0
I have 2 things in my mind.. First;
I have two connection string in web.config.. First for entity framework data model, second for SimpleMembership.. (By the way what can I do for use only one connection string??)
http://forum.yazgelistir.com/JS/HTMLEditor/Image.aspx?id=594&siteid=0
Second;
I create ASP.NET MVC 4 Internet Application.. After I have to set something for using ASP.NET SimpleMembership role..
Do you have in system.web section within web.config....
Note: my roles look to DefaultConnection
This appears to also be mentioned here Role based authentication in the new MVC 4 Internet template using simplemembership
My problem is about InitializeSimpleMembership, because my all pages need login..
Normally AccountController class has it;
We need InitializeSimpleMembership all of our project.. So we create static class in App_Start folder: Exp;
InitializeSimpleMembershipProviderConfig.cs
After we created class, we write this codes into Global.asax;
We have to delete this line under Filters folder
This answer translated from AliRıza Adıyahşi 's answer from yazgelistir.com
THANKS FOR HIS HELP AliRıza Adıyahşi