使用ASP.net成员获得aspnet_Users在Silverlight [英] Using ASP.net membership to get aspnet_Users in silverlight

查看:170
本文介绍了使用ASP.net成员获得aspnet_Users在Silverlight的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

希望有人可以提供帮助。

Hope somebody can help.

有左顾右盼的净但似乎无法来解决(或理解)这一点。

Have looked around on the net but cannot seem to solve (or understand) this.

我曾尝试code张贴在

I have tried the code posted at

<一个href=\"http://blogs.msdn.com/b/kylemc/archive/2010/05/10/using-asp-net-membership-in-silverlight.aspx\" rel=\"nofollow\">http://blogs.msdn.com/b/kylemc/archive/2010/05/10/using-asp-net-membership-in-silverlight.aspx
 (不打算在这里重复类MembershipServiceUser,因为它是很长,可以在网页提到上看到)

http://blogs.msdn.com/b/kylemc/archive/2010/05/10/using-asp-net-membership-in-silverlight.aspx (not going to repeat the class MembershipServiceUser here as it is quite long and can be seen on the mentioned page)

我已经建立了带班和code域的服务来回报用户:

I have set up the domain service with the class and the code to return the users:

//[RequiresRole("Managers")]
public IEnumerable<MembershipServiceUser> GetAllUsers()
{
    return Membership.GetAllUsers().Cast<MembershipUser>().Select(u => new MembershipServiceUser(u));

}

我拿出RequiresRole进行测试。

I took out the RequiresRole for testing.

我似乎什么是有点金发碧眼的就是GetAllUsers的调用()方法。

What I seem to be a bit blonde about is the calling of the GetAllUsers() method.

在我的code后面我使用的:

In my code behind I am using:

MembershipDataContext context = new MembershipDataContext();
EntityQuery<MembershipServiceUser> users = context.GetAllUsersQuery(); 

我不是100%肯定,如果这是使用的方法,或者别的东西是错误的,因为

I am not 100% sure if this is the correct way to use the method or if something else is wrong because

context.GetAllUsersQuery(); returns "Enumeration yielded no results"

一个问题也是在code kylmc采用// RequiresRole(管理)。这是在ASP.NET配置编辑器创建一个自定义角色?

One question is also in the code kylmc uses //RequiresRole("Admin")]. Is this a custom role created in the ASP.NET Configuration editor?

考虑使用Silverlight中的ASP.NET验证服务对于另一个教程,我创建了一个名为经理的角色,并添加登录用户到该角色。
登录使用与角色管理用户并不能帮助和结果仍然没有让步了。

Looking at another tutorial regarding using the ASP.NET authentication service in Silverlight, I create a role called "Managers" and added the login user to that role. Logging in using a user with role Managers doesn't help and results are still not yielded.

任何想法,我能可以看看?

Any ideas I could possible look at?

非常感谢

奥尼尔

推荐答案

有涉及查询两个步骤。


  1. 从域名服务上下文(同步)获取一个查询对象。

  2. 从域名服务上下文(异步)加载查询。

例如:

public void Load()
{
  // define the query
  var query = context.GetAllUsersQuery();

  // start running the query, and when the results return call
  // OnGetAllUsersLoaded
  context.Load(query, OnGetAllUsersLoaded, null);
}

public void OnGetAllUsersLoaded(LoadOperation op)
{
  var results = op.Entities;
}

这篇关于使用ASP.net成员获得aspnet_Users在Silverlight的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆