asp.net - Creating Application/Virtual Directories in a site that POINT to that site to simulate multiple sites. Good idea? -


we need way say

www.site.com/india www.site.com/asia www.site.com/usa etc...

but want these requests point www.site.com , not have physically create files , directories every type of site... if create virtual directory (www.site.com/india) , point www.site.com... figure can @ url , set parameters/text/images accordingly fill out template...

does make sense? or there issues web.configs ? or better way

i encourage consider routing, demonstrated here: http://www.asp.net/mvc/tutorials/asp-net-mvc-routing-overview-cs

the given sample, repeated here can (hopefully) see relevance, is:

using system; using system.collections.generic; using system.linq; using system.web; using system.web.mvc; using system.web.routing;  namespace mvcapplication1 {     // note: instructions on enabling iis6 or iis7 classic mode,      // visit http://go.microsoft.com/?linkid=9394801      public class mvcapplication : system.web.httpapplication     {         public static void registerroutes(routecollection routes)         {             routes.ignoreroute("{resource}.axd/{*pathinfo}");              routes.maproute(                 "default",                                              // route name                 "{controller}/{action}/{id}",                           // url parameters                 new { controller = "home", action = "index", id = "" }  // parameter defaults             );          }          protected void application_start()         {             registerroutes(routetable.routes);         }     } } 

by similar methods, can merely extract information need


the first example mvc routing, webforms routing should here http://msdn.microsoft.com/en-us/library/cc668202(vs.90).aspx , here's (very limited) example:

public static void registerroutes(routecollection routes) {     routes.add("bikesaleroute", new route     (        "bikes/sale",         new customroutehandler("~/contoso/products/details.aspx")     )); } 

using custom routehandler build in code. routehandlers easy use, once hang of it. , allow more expressiveness.


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

html - Instapaper-like algorithm -

c# - How to execute a particular part of code asynchronously in a class -