重写 sharepoint web 部件中的 web.config/在 Web 部件中使用自定义成员资格提供程序
我正在为 MOSS 2007 开发一个 Web 部件。 Web 部件正在部署到 Web 应用程序,该应用程序利用基于表单的身份验证和角色/成员资格提供程序来控制用户。
成员资格表已被编辑以包含附加用户信息(我知道,这不是处理附加用户(即配置文件等)的最佳方式,但是,这是另一个部门的要求)。
由于我的 Web 部件需要访问此信息,因此我正在考虑实现自定义会员资格提供程序。
到目前为止我已经遵循: http://msdn.microsoft.com/en-us/library/6tc47t75。 ASPX 我有我的自定义会员级别,以及一个非常精简的会员提供者级别。
但如何在我的 Web 部件中启用/使用此会员资格提供程序?
我尝试在解决方案的“WebPartCode”文件夹中(位于我的 webpart 代码文件旁边)创建一个简单的 web.config,其中包含连接字符串和成员资格提供程序标签。
但我什至不知道如何构建/引用/使用会员提供者本身,所以我不知道我还需要做什么。
我已经使用两个类(membershipprovider 和自定义membershipuser)构建了一个 C# 类库项目,并对其进行了编译并将其安装在全局程序集缓存中 - 这是正确的吗?我如何从这里访问它们?
希望有人可以帮忙
I'm developing a web part for MOSS 2007.
The web part is being deployed to a web application which utilizes forms-based authentication, and role/membership providers to control users.
The membership table has been edited to include addition user info (I am aware, that this isn't the best way to handle additional user, i.e. profiles etc., however, this is a requirement from another department).
Since my web part needs to access this information, I was thinking of implementing a custom membership provider.
So far I've followed:
http://msdn.microsoft.com/en-us/library/6tc47t75.aspx
and I've got my custom membership class, and a very stripped down membershipprovider-class.
But how do I enable/use this membership provider in my web part?
I've tried creating a simple web.config in the "WebPartCode" folder of my solution, next to my webpart code file, with connection string and membership provider tags.
But I don't even really know how to build/reference/use the membership provider itself, so I don't know what else I need to do.
I've built a C# class library project with the two classes (membershipprovider and custom membershipuser) and compiled it and installed it in the global assembly cache - is this correct? and how do I access them from here?
Hope someone can help
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您已经设置并运行了 FBA,因此您不需要在管理中心为您的 Web 应用程序进行任何更改。不过,供您参考,UI 设置可在管理中心的“应用程序管理”-“身份验证提供程序”下找到。
您需要在场中每台 Sharepoint 服务器上的 GAC 中或场中每台 Sharepoint 服务器上 Web 应用程序的 bin 目录中安装会员资格提供程序的 DLL。我建议将 DLL 打包到解决方案中以便部署它们。
然后需要在 Sharepoint IIS 站点(例如 Web 应用程序)的 web.config 中配置 FBA。这可以在 C:\Inetpub\wwwroot\wss\VirtualDirectories\[Web 应用程序名称]\web.config 中找到,并且需要为场中的每个 Sharepoint 服务器进行配置。
请注意,通过在特定 Web 应用程序上安装自定义会员资格提供程序,您必须删除现有的会员资格提供程序。这可能会给现有用户带来问题,除非您的自定义会员资格提供商使用与当前会员资格提供商使用的相同的会员数据库(例如,用户名/密码)。
You already have FBA set up and working, so you shouldn't need to make any changes in Central Administration for your web application. However, for your reference, the UI settings are found in Central Administration under 'Application Management' - 'Authentication Providers.'
You will need to install the DLLs for your membership provider either in the GAC on every Sharepoint server in your farm or in the bin directory for your web application on every Sharepoint server in your farm. I would recommend packaging your DLLs up in a solution in order to deploy them.
FBA then needs to be configured in the web.config for your Sharepoint IIS site (e.g., web application). This can be found at C:\Inetpub\wwwroot\wss\VirtualDirectories\[Name of Web App]\web.config, and this needs to be configured for every Sharepoint server in your farm.
Please note that by installing your custom membership provider on a particular web application, you will necessarily remove the existing membership provider. This may cause problems for existing users unless your custom membership provider uses the same member database (e.g., usernames/passwords) that the current membership provider uses.