简体   繁体   English

从错误代码背后访问Profile对象? (ASP.NET 2.0提供程序模型)

[英]Accessing the Profile object from Code Behind Bug? (ASP.NET 2.0 Provider Model)

I have been playing around w/ ASP.NET's Membership, Roles, and Profile providers. 我一直在玩ASP.NET的成员资格,角色和配置文件提供程序。 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/ ) 为此,我最近设置了Microsoft Sample的自定义表配置文件提供程序(请参阅: http : //www.asp.net/downloads/sandbox/table-profile-provider-samples/

When I run the test solution I have programatic access to the Profile variables. 运行测试解决方案时,我可以通过编程方式访问Profile变量。 Ie 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. 在后面的代码中,Intellsense将使我可以访问我的自定义配置文件变量(在web.config中进行设置)... LastName,FirstName,Age等。

However, when I set up the same scenario in my own solution and type in Profile. 但是,当我在自己的解决方案中设置相同的方案并在Profile中键入时。 in code-behind, it does not recognize the object in IntelliSense and won't compile if I type it myself. 在后台代码中,它无法识别IntelliSense中的对象,并且如果我自己键入该对象将无法编译。

That being said... If I type <%= Profile. 话虽这么说...如果我键入<%= Profile。 in the front end, VS gives me what I'm looking for (the front end Intellisense pops up with my defined Profile variables) 在前端,VS给了我想要的东西(前端Intellisense弹出了我定义的Profile变量)

Has anyone else had this problem / Know a solution 有没有其他人有这个问题/知道解决方案

Thanks! 谢谢!

-Mike -麦克风

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

Seems my issue is that Profile is only valid for the VS.NET Website Template (NOT for the Web Application Template) 似乎我的问题是,配置文件仅对VS.NET网站模板有效(对于Web应用程序模板无效)

-Mike -麦克风

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM