SqlProfileProvider - can you use Profile.GetProfile() in a project?

99封情书 提交于 2019-12-04 06:48:55

问题


I am attempting to use the SqlProfileProvider in an application and can't seem to use it the way I want to. I would like to be able to simply call up a profile like this:

Profile p = Profile.GetProfile("naspinski");
p.Organization = "new_org";

but I can't seem to find the correct way to use the GetProfile() that I seem to see scattered around the net. Is there a way to grab, read and modify profiles?

I am using it in MVC 3 and will not be actually logging in as the specific user, this will be pulling users from the db that are specified. Thank you.


回答1:


To retrieve the profile:

var profile = ProfileBase.Create(HttpContext.Profile.UserName, true);

And here's the MSDN documentation. And a nice blog post about custom profiles.



来源:https://stackoverflow.com/questions/5019119/sqlprofileprovider-can-you-use-profile-getprofile-in-a-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!