Web应用程序项目 - 如何使用的ProfileCommon [英] Web Application Project - how to use ProfileCommon
问题描述
我端起我在一个旧箱子开发了一个网站跨到一个新的开发ENV。我已经不只是复制所有文件,因为我没有一个很大的文件结构和所需的code的某些部分被删除,因为我就跟着去了。
I am porting a site I had developed on an old box across to a new dev env. I have not just copied all the files as I didn't have a great file structure and some parts of the code needed to be removed as I went along.
本来我已经创建了一个网站(文件 - >新建 - > Web站点)。我想要一个文件结构是这样的:
Originally I had created a website (File -> New -> Web Site). I wanted a file structure something like:
<一个href=\"http://stackoverflow.com/questions/446017/popular-folder-structure-for-build\">http://stackoverflow.com/questions/446017/popular-folder-structure-for-build
所以,我创建了一个新的空白溶液使SLN文件是对自己,然后加到项目(各种DLL项目)和我的ASP.NET Web应用程序。
So I created a new blank solution so the sln file was on its own, then added projects (various DLL projects) and am ASP.NET Web Application.
这最后一部分似乎已经给我带来了一些问题,现在我收到以下错误:
This last part seems to have caused me a few issues, I am now getting the following error:
的类型或命名空间名称的ProfileCommon找不到。
"The type or namespace name ' ProfileCommon' could not be found".
我发现了以下页面:
<一个href=\"http://weblogs.asp.net/joewrobel/archive/2008/02/03/web-profile-builder-for-web-application-projects.aspx\">http://weblogs.asp.net/joewrobel/archive/2008/02/03/web-profile-builder-for-web-application-projects.aspx
这似乎有点长篇大论,我希望有人可能知道一个更好的解决方案。
It seems a bit long winded and I was hoping someone might know of a better solution.
我想使用的ProfileCommon与CREATEUSER向导我添加一些额外的信息内容。
I am trying to use the ProfileCommon with the CreateUser Wizard as I add a little extra information into it.
protected void CreateUserWizard1_CreatedUser(object sender, EventArgs e)
{
// Create an empty Profile for the newly created user
ProfileCommon p = (ProfileCommon)ProfileCommon.Create(CreateUserWizard1.UserName, true);
// Populate some Profile properties off of the create user wizard
p.CurrentLevel = Int32.Parse(((DropDownList)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("clevel")).SelectedValue);
// Save profile - must be done since we explicitly created it
p.Save();
}
Web.config文件:
Web.config:
<profile enabled="true">
<properties>
<add name="CurrentLevel" type="Int32"/>
</properties>
</profile>
如果有另一种方式来增加这些额外的信息到创建向导,或者只是一个额外的信息设置为一个新的用户,然后我所有的耳朵,他很感激的更好的方法。
If there is another way to add this extra information into the creation wizard, or just a better way of setting extra info to a new user then I am all ears and would be very grateful.
感谢您的帮助和建议。
推荐答案
我发现了一个解决方案这一个。不知道这是否是最好的或没有,但它的工作对我的处境。需要最少code的变化。
I found "a" solution to this one. Not sure if it is the best one or not but it worked for my situation. Minimal code changes required.
http://msdn.microsoft.com/en-us/library/ aa983476.aspx
希望它可以帮助别人,(或我,当我再次忘了)。
Hope it might help someone else, (or me when I forget it again).
这篇关于Web应用程序项目 - 如何使用的ProfileCommon的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!