How to override Silvelright 4 RIA Service AuthenticationService User.IsInRole

半腔热情 提交于 2020-01-25 13:11:28

问题


I've started out with the Silverlight 4 Navigation Application template (RIA Services enabled). (As I really don't like the bloated Business Application Template) I've added an Authentication Service and I'm able to authenticate users, but want to override the User.IsInRole method.

WebContext.Current.User.IsInRole("Guest");

But I cannot find any place to override the behaviour.


回答1:


What are you trying to do? User.IsInRole is an implementation of IPrincipal.IsInRole and really shouldn't be overridden.

If you want to set the user roles, you can do it on the server in your AuthenticationService by overridding the GetAuthenticatedUser or GetAnonymousUser methods.

If you want a method similar to IsInRole, you can extend the User type with a partial class on the client and add whatever methods make sense.



来源:https://stackoverflow.com/questions/3584078/how-to-override-silvelright-4-ria-service-authenticationservice-user-isinrole

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!