I'm in the midst of creating a new website for the model airplane club and wanted to use some of the features that ASP.NET 2.0 gives us for free. Like User Profiles. However, after defining a profile in web.config I still couldn't access the auto-generated Profile object. I searched google for an answer but didn't really come up with anything. I tried some examples from the net and they all worked fine. I was about to give up when I discovered the difference. It turns out that the Profile object isn't generated when you use a Web Application Project (the "old" 2003 model, available in 2005 SP1). So I converted my whole site to a standard Web Site and everything worked just perfectly.

I researched a bit more and came across this post on Scott Guthrie's blog. In the comments, someone asks exactly the same question as me - "Why can't I access my Profile object?". Scott links to this add-in for Visual Studio that can generate a strongly typed class for accessing the ASP.NET Profile object in a Web Application Project. It works both with C# and VB projects.

comments powered by Disqus