I have created my own custom role provider class "SGI_RoleProvider" and configured properly. Everything is working fine.
Suppose that I have added a public method say "SayHello()", then how can i call that. Because if i am using Roles then the method is not displayed. If i am forcefully using that Rol开发者_如何学编程es.SayHello() then compiler gives the error.
Any suggestion how can i call this. Because creating a new instance of SGI_RoleProvider is meaningless.
Thanks for sharing your time.
var myProvider = Roles.Provider as SGI_RoleProvider;
myProvider.SayHello();
Supposing you have correctly defined your provider as the default Provider
Maybe you can do something like
((SGI_RoleProvider)Roles.Provider).SayHello();
One line syntax does it all.
精彩评论