IIS configuration with support of multiple domain urls

30 篇文章 0 订阅
8 篇文章 0 订阅

/*

Author: Jiangong SUN

*/


Today I have encountered a problem, I spent 3 hours and a half for figuring it out. I need to make the application compatible with muiltiple domain urls. 


I need to get the country information when parsing the two urls: cn.xx.xxx.xxxx.com and web-cn.xx.xxx.xxxx.com

What i need is simply "cn".


Here is my code : 

//Detect country by subdomain and get first culture in Front (ex  : cn.xx.xxx.xxxx.com )
//Add possibility of detect the culture in Contrib Front ( ex : web-cn.xx.xxx.xxxx.com )
if (Request.Url.Host.IndexOf('.') == 2 || Request.Url.Host.IndexOf('.') == 6)
{
	string s = Request.Url.Host.Split('.')[0];
	//Log.Error("host first part : " + s + "\n");
	string l = s.Substring(s.Length - 2);
	//Log.Error("host culture : " + l + "\n");
	Culture cult = GetCulture(l).FirstOrDefault();
}


I have two test cases in my recette envrionment, on called Contrib, the other call Front. They hold the same codes and same configurations. But in fact it works in one case and not the other one.

With confusions and frastration during 3 hours, I've found that it's because there is a tiny difference between their configurations in IIS 6.

It's just the parameter " DefaultDoc". My application's default page is "Default.aspx". It won't work if i don't indicate it in my IIS configuration. The case not working doesn't have this parameter. 

<IIsWebVirtualDir	
		Location ="/LM/W3SVC/98004751/root"
		AccessFlags="AccessRead | AccessWrite | AccessScript"
		AppFriendlyName="AP Contrib"
		AppIsolated="2"
		AppPoolId="AP"
		AppRoot="/LM/W3SVC/98004751/Root"
		AuthFlags="AuthAnonymous | AuthNTLM"
		DefaultDoc="Default.aspx,Default.htm,Default.asp,index.htm"
		DirBrowseFlags="EnableDirBrowsing | DirBrowseShowDate | DirBrowseShowTime | DirBrowseShowSize | 	
		DirBrowseShowExtension | DirBrowseShowLongDate | EnableDefaultDoc"
		MimeMap=".woff,application/x-woff"
		Path="G:\CONTRIB"
		ScriptMaps="">
</IIsWebVirtualDir>

AT LAST, it work for me. Enjoy coding!!!


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值