0
我想知道是否有一種方法來介紹Asp.net 3.5子域路由Asp.net 3.5 Sp1子域路由?
所有我發現,因爲這http://blogs.securancy.com/post/ASPNET-MVC-Subdomain-Routing.aspx
但我一直在尋找更復雜的東西,讓做野生卡子 - 域名
任何幫助?
我想知道是否有一種方法來介紹Asp.net 3.5子域路由Asp.net 3.5 Sp1子域路由?
所有我發現,因爲這http://blogs.securancy.com/post/ASPNET-MVC-Subdomain-Routing.aspx
但我一直在尋找更復雜的東西,讓做野生卡子 - 域名
任何幫助?
應該沒有問題,即使是那個樣本。在這種情況下,只需在您的DNS「* .yourdomain」中添加通配符,然後使用交換機中的'default'語句來處理通配符。
換句話說,對於在Global.asax樣品更改爲類似:
default:
returnValue = new RouteData(this, new MvcRouteHandler());
returnValue.Values.Add("controller", "MyControllerName");
returnValue.Values.Add("action", "MyActionName");
// for example, provide the entered subdomain as parameter;
returnValue.Values.Add("MyActionParameterName", subDomain);
break;
而且不要忘記:通配符添加到您的DNS。但是,不應該可以在本地主機上測試子域。
但我想在這種情況下,網址會是這樣的 HTTP://example.yourdomain/MyControllerName/MyActionName/ MyActionParameterName =子域 權......這是我的文章鏈接在同一個點?在我的問題 – 2009-05-19 17:18:30