搜索 ASP.Net 配置文件
我正在寻找一种使用标准 ASP.Net 配置文件提供程序来搜索每个用户配置文件的方法。 这可能吗,还是我应该创建一个新的配置文件提供程序?
场景如下:
- 用户注册
- 用户设置他们的个人资料(最喜欢的颜色、最喜欢的书、国家等)
- 然后用户可以浏览其他用户,例如,最喜欢的颜色为“绿色”
我想使用这个所有这些都通过会员/个人资料提供商进行,而无需直接针对数据库进行编码。
I am looking for a way to search through every users profile using the standard ASP.Net Profile Provider. Is this possible, or should I create a new Profile Provider?
Here is the scenario:
- User registers
- User sets up their profile (favorite color, favorite book, country, etc)
- User is then able to browse other users who, for instance, have a favorite color of "Green"
I would like to use this all through the membership/profile providers without having to code against the database directly.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您想要的功能包含在 Profile API 中。
您可以使用以下方式获取单个用户的个人资料:
您可以使用以下方式获取所有个人资料:
The functionality you want is included in the Profile API.
You can get an individual users profile using:
You can get all the profiles using:
我相信标准提供者只适用于当前用户。 您需要一个自定义配置文件提供程序来检索其他用户的信息。 幸运的是,它确实是
I believe the standard provider will only work for the current user. You would need a custom profile provider to retrieve the information for other users. Fortunately it is really easy to do. That link has an example of a custom provider that allows you to retrieve the profiles of other users. If you use his example, be sure to note the person's comment about removing the profile section from your web.config. I had to do that to make mine work correctly.