问题
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
回答1:
For Web Application projects, see here: http://code.msdn.microsoft.com/WebProfileBuilder
回答2:
Seems my issue is that Profile is only valid for the VS.NET Website Template (NOT for the Web Application Template)
-Mike
来源:https://stackoverflow.com/questions/407845/accessing-the-profile-object-from-code-behind-bug-asp-net-2-0-provider-model