A
aitor
Hello,
I am doing a management of roles for users. At the beginning every user
will have only one role. I haven´t used role provider because I don´t want
to add a new record into the database. I just want to add roles and when I
restart the application, with the global.asax file will be assigned roles
that I had at the beginning. How can I do to add roles during the execution?
Using Roles.AddUserToRole() function doesn´t work because role provider is
disabled.
I use this sentence in Global.asax:
string[] difRoles = new string[1] { "administrator" };
HttpContext.Current.User = new
System.Security.Principal.GenericPrincipal(User.Identity, difRoles);
But if I use this sentence in execution is not working.
Do you know what sentence should I use to get what I want?
Thank you.
I am doing a management of roles for users. At the beginning every user
will have only one role. I haven´t used role provider because I don´t want
to add a new record into the database. I just want to add roles and when I
restart the application, with the global.asax file will be assigned roles
that I had at the beginning. How can I do to add roles during the execution?
Using Roles.AddUserToRole() function doesn´t work because role provider is
disabled.
I use this sentence in Global.asax:
string[] difRoles = new string[1] { "administrator" };
HttpContext.Current.User = new
System.Security.Principal.GenericPrincipal(User.Identity, difRoles);
But if I use this sentence in execution is not working.
Do you know what sentence should I use to get what I want?
Thank you.