简体   繁体   English

多个域使用不同的设置重定向到一个站点

[英]Multiple domains redirect to one site with different settings

I have an asp.net webforms application that I want to be shared to multiple customers from different domains. 我有一个asp.net Webforms应用程序,希望与来自不同域的多个客户共享。 Each domain should redirect to my main domain and keep its name at the address. 每个域都应重定向到我的主域,并在地址中保留其名称。 My application should change its css settings according to the initial domain request. 我的应用程序应根据初始域请求更改其CSS设置。

I have done the redirection and the css handle but I am unable to determine the initial domain name, thus the default theme is displayed. 我已经完成了重定向和CSS句柄,但无法确定初始域名,因此显示了默认主题。

How can I determine the initial domain? 如何确定初始域?

Here is my code befind: 这是我的代码:

If Page.Request.Url.Host.ToUpper = "secondDomain.com".ToUpper Then
    customCss.Href = "css/secondDomain.css"
Else
    customCss.Href = "css/default.css"
End If

for testing purposes I have also added: 为了测试,我还添加了:

ScriptManager.RegisterStartupScript(Me.Page, Me.Page.GetType, "myAlert", 
                                    "alert(""" & Page, Me.Page.GetType, "myAlert", "alert(""" & 
                                               Page.Request.Url.Host.ToUpper & " - " & 
                                               Page.Request.Url.DnsSafeHost & " - " &
                                               Page.Request.Url.OriginalString & " - " &
                                               Request.ServerVariables("SERVER_NAME") & """);",
                                      True)

I am getting always the main domain and not the initial. 我总是得到主要的领域,而不是最初的领域。

at markup I have: 在加价时,我有:

<link rel="stylesheet" type="text/css" href="css/default.css" runat ="server" id="customCss" />

any ideas? 有任何想法吗? thanks 谢谢

For anyone might concern...I have made a work around with url rewrite. 对于任何可能关心的人...我已经进行了URL重写的工作。 I have added "/theme/secondDomain" at the redirect url and convert it to theme=secondDomain. 我在重定向URL上添加了“ / theme / secondDomain”,并将其转换为theme = secondDomain。

Thus, now I am checking the QueryString and changing the css accordingly... 因此,现在我正在检查QueryString并相应地更改css ...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM