在 ASP.NET Web 应用程序中使用配置文件的解决方案是什么?

发布于 2024-08-02 17:37:28 字数 67 浏览 2 评论 0原文

由于 Web 应用程序不像网站项目那样公开 ProfileCommon 类,因此可以使用哪些解决方案来访问配置文件信息。

What solutions are available to access Profile information since Web Applications do not expose ProfileCommon class like Web Site projects do.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

心的憧憬 2024-08-09 17:37:28

虽然可能不是最好的选择(但就像您没有找到明显的其他选项一样 - 我也使用自定义配置文件对象并没有帮助),但我使用了以下内容:

ProfileBase pb = ProfileBase.Create(Page.User.Identity.Name);
m_PreferredName = pb.GetPropertyValue("WebName") as string;

更多详细信息,包括获取的示例可以在创建方法文档中找到它到自定义类型

Whilst possibly not the best option (but like you didn't find an obvious other option - it doesn't help that I'm also using a custom profile object), I've used the following:

ProfileBase pb = ProfileBase.Create(Page.User.Identity.Name);
m_PreferredName = pb.GetPropertyValue("WebName") as string;

More details, including examples of getting it into a custom type can be found in the Create Method documentation

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文