如何在 ASP.Net MVC 应用程序中使用 DotNetNuke 会员数据库
我想用一个基于 MVC 构建的辅助应用程序来补充我现有的 DotNetNuke 网站。
为此,我想在单独的子域(例如 subapp.mydomain.com)上设置 MVC 应用程序并连接到同一数据库。
我已经尝试过了,我可以让 MVC 应用程序在 ASP 成员级别进行连接(仅使用普通表单和身份验证提供程序) - 但我想知道是否有任何方法可以让 MVC 应用程序使用完整的 DotNetNuke 会员提供程序 - 以便我可以在 MVC 应用程序中调用 DotNetNuke.Entities.Users.UserController.GetCurrentUserInfo()
?这只是使用 DotNetNuke 会员 DLL 并更改 web.config 的情况吗?如果是这样,我需要使用哪些设置? - 我已经尝试过,但最终出现了很多黄屏死机,
感谢您的任何指示/建议。
I'd like to supplement my existing DotNetNuke website with a side application which is built on MVC.
To do this, I'd like to set the MVC application up on a separate subdomain (e.g. subapp.mydomain.com) and to connect to the same database.
I've tried this already and I can get the MVC app to connect at the ASP membership levels (just using the normal forms and authentication providers) - but I'm wondering if there is any way I can get the MVC app to use the full DotNetNuke membership providers - so that I can call DotNetNuke.Entities.Users.UserController.GetCurrentUserInfo()
within my MVC application? Is this just a case of using the DotNetNuke membership DLLs and changing the web.config? If so, which settings do I need to use? - I've tried and just ended up with lots of yellow-screens-of-death
Thanks for any pointers/advice.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为您需要向 MVC 站点添加大量 DNN 才能使其正常工作。我相信,DNN 通过 web.config 中设置的一些 HTTP 模块以及 Global.asax 中的一些代码来处理和设置当前用户信息。因此,我认为第一步是将 DNN web.config 的
httpModules
部分引入您的 MVC 站点,然后获取dotnetnuke
配置部分,以及(或者至少是看起来相关的部分)。然后看看这是否至少改变了您看到的错误消息。话虽如此,我仍然认为您会丢失 Global.asax 中的一些代码(至少,设置其依赖项注入容器)。我不确定您是否想尝试将该代码也迁移到您的 MVC 应用程序中...
I think you're going to need to add a lot of DNN to your MVC site in order for this to work. DNN processes and sets the current user information via some HTTP modules setup in the web.config, as well as some code in the Global.asax, I believe. So, I would think that the first step would be to bring over the
httpModules
section of the DNN web.config into your MVC site, and then also get thedotnetnuke
configuration section, as well (or at least the sections that seem related). Then see if that, at least, changes the error message you're seeing.All that being said, I still think you'll be missing some code from the Global.asax (at the least, setting up their dependency injection container). I'm not sure if you want to try to migrate that code into your MVC app as well, or not...