ASP.NET登录从父域子域 [英] ASP.NET login to subdomain from parent domain

查看:168
本文介绍了ASP.NET登录从父域子域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有了为每一个客户一个子域例如一个ASP.Net MVC网站customer1.site.com,customer2.site.com等。

I have an ASP.Net MVC site that has a subdomain for each customer e.g. customer1.site.com, customer2.site.com, etc.

登录工作从customer1.site.com/login和customer2.site.com/login使用标准的ASP.Net FormsAuthentication罚款。

Login works fine from customer1.site.com/login and customer2.site.com/login using the standard ASP.Net FormsAuthentication.

我怎样才能从父域登录(例如site.com/login),用户指定一个表单域的子域名?我想在auth cookie被存储针对customer1.site.com或customer2.site.com如此明显需要重定向并以某种方式重新发布的登录表单。

How can I login from the parent domain (e.g. site.com/login) where the user specifies the subdomain name in a form field? I'd like the auth cookie to be stored against customer1.site.com or customer2.site.com so obviously need to redirect and repost the login form somehow.

推荐答案

我最终被分成两个单独的页当前解决这个。在第一个页面,用户只能在表单中输入的子域名(例如的customer1)上提交他们将被重定向到子域登录页面(例如customer1.site.com/login)的形式。

I ended up solving this by splitting this into two separate pages. On the first page the user can enter the subdomain name (e.g. customer1) only in a form, on submitting the form they are redirected to the subdomain login page (e.g. customer1.site.com/login).

这篇关于ASP.NET登录从父域子域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆