从代码隐藏错误访问配置文件对象? (ASP.NET 2.0 提供者模型)

发布于 2024-07-10 07:58:07 字数 614 浏览 4 评论 0原文

我一直在研究 ASP.NET 的成员资格、角色和配置文件提供程序。 为此,我最近设置了 Microsoft Sample 的自定义表配置文件提供程序(请参阅:http://www.asp.net/downloads/sandbox/table-profile-provider-samples/

当我运行测试解决方案时,我可以通过编程访问配置文件变量。 即我可以输入个人资料。 在后面的代码中,Intellsense 将使我能够访问我的自定义配置文件变量(在 web.config 中设置)...姓氏、名字、年龄等。

但是,当我在自己的解决方案中设置相同的场景并输入时轮廓。 在代码隐藏中,它无法识别 IntelliSense 中的对象,并且如果我自己键入它,也不会编译。

话虽这么说...如果我输入 <%= Profile. 在前端,VS 给了我我正在寻找的东西(前端智能感知弹出我定义的配置文件变量)

还有其他人遇到这个问题/知道解决方案吗

谢谢!

-麦克风

I have been playing around w/ ASP.NET's Membership, Roles, and Profile providers. In doing so, I recently set up Microsoft Sample's custom Table Profile Provider (see: http://www.asp.net/downloads/sandbox/table-profile-provider-samples/)

When I run the test solution I have programatic access to the Profile variables. I.e. I can type Profile. in the code behind and Intellsense will give me access to my custom Profile variables (setup in the web.config) ... LastName, FirstName, Age, etc.

However, when I set up the same scenario in my own solution and type in Profile. in code-behind, it does not recognize the object in IntelliSense and won't compile if I type it myself.

That being said... If I type <%= Profile. in the front end, VS gives me what I'm looking for (the front end Intellisense pops up with my defined Profile variables)

Has anyone else had this problem / Know a solution

Thanks!

-Mike

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

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

发布评论

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

评论(2

送君千里 2024-07-17 07:58:07

对于 Web 应用程序项目,请参阅此处:http://code.msdn.microsoft.com/WebProfileBuilder

For Web Application projects, see here: http://code.msdn.microsoft.com/WebProfileBuilder

又爬满兰若 2024-07-17 07:58:07

看来我的问题是 Profile 仅对 VS.NET 网站模板有效(不适用于 Web 应用程序模板)

-Mike

Seems my issue is that Profile is only valid for the VS.NET Website Template (NOT for the Web Application Template)

-Mike

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