Thursday, May 24, 2007

A problem with ASP.NET client side validation and IIS host headers

I've just had an interesting issue when deploying an ASP.NET application on to a web site that uses host headers. Host headers is where you can point multiple domains at a single IIS and IIS can resolve them to multiple virtual directories. ASP.NET requires some javascript files in a virtual directory under the root called ‘aspnet_client’ for its client side functionality such as the validation controls. If you’re creating your application in a virtual directory, e.g: Then installing the .net runtime will put those files in the right place for that app: The problem comes when you use host headers to resolve additional subdomains to a virtual directory: ASP.NET looks for its javascript files here: But it won’t find them unless you remember to manually copy that directory to the root of your application. It’s something to be aware of (especially since it happened to me twice, double duh!)


Anonymous said...

I've been trying to implement a subdomain for 2 weeks now. Could you be more specific? I don't understand. I can't get my pages to connect to the database, also stored in an App_Data folder in the subdomain.


Mike Hadlow said...

Hi Karen, subdomains are a totally different from host headers. Good luck with solving your problem though.