iis 7 - How to manage sub-domains on winhost with URL Rewrite and ASP.NET Optimization's bundles -


i using asp.net mvc4 winhost.

just question asked here, ran same issue:

i'm trying out winhost , i'm running issues sub-domains. on winhost, can have multiple sub-domains per hosting account, each sub-domain points root website. e.g. can have www.example.com, sub1.example.com, , sub2.example.com of them display content @ http://www.example.com/.

other hosts allow point sub-domains sub folder in website. allow point sub1.example.com /sub1, sub2.example.com /sub2 , www.example.com /.

winhost recommends using asp/aspx page redirect http://sub1.example.com http://sub1.example.com/sub1, points /sub1. while work, i'd not have subdomain in url twice.

so tried using iis7 url rewrite point http://sub1.example.com /sub1. ben powell describes in detail on his blog.

i've managed portion work http://sub1.example.com points virtual application "/sub1" in iis.

if use url.content, works flawlessly.

now, using asp.net optimization , bundle scripts , css. issue absolutely require relative url ie:

            bundles.add(new scriptbundle("~/bundles/jqueryval").include(                     "~/scripts/jquery.unobtrusive*",                     "~/scripts/jquery.validate*")); 

however, because it's relative url here in markup:

<script src="/sub1/bundles/jqueryval?v=ugyemayousb9bb6hcoevhpd6fiip54yf086srnvcdiy1"></script> 

of course, because of "sub1" doesn't find file. thought url redirect never got work. maybe route in mvc? unsure how well. drop bundling alltogether use "url.content" think sad.

what best way handle issue?

i know can use ibundletransform modify contents in bundle based on unique circumstances. may able modify bundle context itself. here link mvc4 stylebundle not resolving images


Comments

  1. I went with Winhost based on the recommendation of my developer and I couldn't have been more pleased. I was completely new to this stuff but had done some research and knew the functionality I wanted and these guys delivered. From my perspective, I would recommend them to anyone in the market for hosting services - https://winhostpromocode.wordpress.com/

    ReplyDelete

Post a Comment

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -