douzhao5656 2018-07-03 20:12
浏览 40
已采纳

允许我的ASP.Net MVC站点的用户访问我的私人WordPress站点

I have an ASP .Net MVC site and I would like users who are logged in to my site to be able to access a separate WordPress site which I also own. Otherwise, if a user is not logged into my ASP .Net site, the WordPress site should remain private.

What is the easiest way to implement this? I thought about SSO but it seems like overkill for this simple scenario. I don't need users identified on the WordPress site; they won't be allowed to post or anything, all they can do is just read my posts there.

  • 写回答

1条回答 默认 最新

  • dswsl2016 2018-07-10 01:19
    关注

    I ended up making the whole WP site private except to logged in users by using a plugin (Ultimate Member). Then I created a single login which would be used from the .Net site. The way it works is:

    1. User clicks on link within .Net site to access WordPress site
    2. Server-side: performs POST to /wp-login.php with credentials for single WP user
    3. Server-side: retrieve cookies from wp-login.php response
    4. Client-side: call to custom PHP page on WP site: /setcookies.php and set user’s session cookies for WP site domain using cookies from previous step
    5. Client-side: open WP site in iframe using session cookies
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度