Multiple Domains Using Url-Rewriter

Discussion in 'ASP.NET / ASP.NET Core' started by clubber, Aug 16, 2008.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. Has anyone ever successfully used either of these UrlRewriter tools to trick out a DiscountASP.net account to allow for two totally separate domains and asp.net applications?

    http://code.msdn.microsoft.com/urlrewriter
    http://cheeso.members.winisp.net/IIRF.aspx

    (I'm using the first one at the moment.)

    I'm trying to do something that is easy as pie in LAMP hosting, but has been a nightmare for me to get working with my DiscountASP.NET account. My account uses the domain X.com. I also have a domain called Y.com. I've already set up a domain pointer for Y.com to go to the root of X.com. (This seemed counter-intuitive to me, since what I really want is for the domain to point to a subfolder called ysite, but I'm trying to go with the flow...)

    I don't want users of Y.com to know anything about X.com. Two separate ASP.NET applications, two separate web sites. The 'ysite' subfolder is hidden from the outside world. I need something that works for *all* resources under Y.com, not just ASP.NET resources and not just redirecting the root. For example: the actual path to an image is this:

    x.com/ysite/images/abc.jpg

    I can live with it if there's no way to disable the above path, but what I can't live without is the ability to hide the existence of this path from the outside world (meaning, if I never link to it that way, no one will ever know it exists). I want that path to appear as:

    y.com/images/abc.jpg

    I just want the web server to handle the routing to either the root folder or to the designated subfolder. I don't want a lame script in my root default.aspx page, and I do not want to use Response.Redirect, which sends all requests for an extra round trip through the browser. Some threads here have ended with people recommending the use of one of the aforementioned urlrewriting tools. Sounds like it's worth a try, especially since it seems to work as an ISAPI handler, which means I should be able to configure the server once and forget about it.

    But has anyone ever gotten this to work? Or is this a pipe dream?

    Can anyone post examples of RewriteCond and RewriteRule lines that they have used to get this working?

    Or does anyone have specific examples on getting something like this to work as I've described via some other method? Maybe I just need to design my ASP.NET applications a certain way to deal with this? I'm open to anything that works that's not a total hack.

    If I'm screwed here, can anyone recommend an ASP.NET web host that will let me do what should be the easiest thing to do in the world? I just don't understand how this can be considered an acceptable norm for ASP.NET hosting. A nice person from tech support told me this is indeed the norm at other hosts also and explained to me about isolated app pools being the reason it can't be done--but I remain skeptical that there is a valid technical reason why this has to be so difficult (or, as I fear, impossible). I cannot afford to double my hosting expense by opening up a whole separate account just so I can have a second web site.

    Sorry for the crappy attitude, but this is the last thing I expected to have to deal with when I signed up for his account. If anyone can help, I really appreciate it.

    clubber

    Post Edited (clubber) : 8/16/2008 10:13:12 PM GMT
     
  2. Hi,
    In the WROX book "Professional ASP.NET 3.5: In C# and VB", chapter 27...
    There's some very good code modules for both page and image URL re-writing.
    The book is available on http://www.amazon.com/ for $32.99, or $29 used.

    I've got that book and wouldpost the code here but that will be an infrigement.

    You can also look at some of the public ASP.NET blog projects, many of them have modules that do what you want.
    Salute,
    Mark
     
  3. Thanks for the pointers, Mark. I will look into the Wrox book for sure, and maybe also look at a few blog packages for code examples.

    If anyone else wouldn't mind discussing the theory a bit, that would be awesome. Part of the challenge I'm having is that while I'm finding a lot of general information about url rewriting techniques, I'm not finding anything on my specific situation, which I would have imagined is common: I have an ASP.NET hosting account where I want to have multiple web sites, each web site its own ASP.NET application with its own domain, such that all of the links, references, and code can treat the root of the 'ysite' subfolder as its own root. I'm having trouble coming up with a mental model for how it will all work, architecturally speaking.

    I understand that the server is routing all requests for Y.com to the root of X.com. I understand that IIS (6, I presume) has a chain of ISAPI handlers, one of which is ASP.NET. In the ASP.NET application that is the root of my site, I know I can hook into certain things for redirecting purposes, like Application_BeginRequest. However, I don't see how I can do that and still have Y.com in the subfolder be its own ASP.NET application, separate from the root. Not only that, I would ideally like Y.com to have its own root, to *be* its own root. That said, I can live with needing to do some url rewriting in the Y.com application as long as I can isolate it in one place.

    The two url-rewriters seem like the most promising direction so far, but I'd feel a lot better pursuing it if I knew other Discount users had used it successfully. My experiments with it so far have not been fruitful. I'll hold out some hope (I had about given up hope) since Mark's comments appear to indicate that he has some confidence that this can be done.

    Thanks again,
    clubber
     
  4. Thanks again, Mark. FWIW, the project you like to is the same one I link to at the top of my original post:


    http://code.msdn.microsoft.com/urlrewriter


    A comment in the discussion area indicates that the author moved it from codeplex because he's not sharing the code, but it's still there in codeplex, and that's the one everyone links to. Anyway, this is the option that seemed most hopeful to me, but I have not yet had any luck either developing a mental image of how this works architecturally or with a particular set of RewriteCondand RewriteRulelines that allows one to split a DiscountASP.net hosting account into multiple domains and ASP.NET applications.


    Several of the threads on this topic in these forums end in people linking to this urlrewriter tool, but no one seems to indicate that they have actual knowledge that it can be made to work for these purposes, and unfortunately none of the original posters follow up with a comment on whether they got it to work. My #1 hope in this thread is that some kind soul who has gotten this to work will explain how they did it. I'd even be happy if someonesaid they got what I am trying to do working but they're going to keep it a secret. :) At least then I'd have more hope that I'll figure it out myself eventually.


    (I amreally restraining myself here from letting my frustrations flare up againin regards to even *being* in this situation given how easy this is to do in LAMP hosting--I need to be writing code for my web apps, not screwing around with getting my hosting account configured...deep breath...counting to ten...)


    Best,


    clubber
     
  5. FWIW, I had edited my original post to include less of my expressions of frustration, but for some reason that edit is not showing up anymore. I had gone back and edited the post because I'm really not trying to be an @$$hole;I just want to get this to work. In the same edit, I had alsotried to make some of my details more clear, so if anything I've said is not making sense, I'd be happy to clarify.


    Thanks again,


    clubber
     
  6. mjp

    mjp

    That would have been me. I didn't mean to implythat it was common at other .NET hosts though. I said, "You are certainly correct that multiple (or unlimited) domain configuration is common at *nix hosts. There are a number of related problems that are also common at such hosts."

    The reason itcan seemrelatively difficult to implement multiple domains here is somewhat related to the hosting platform, but also, honestly, becasue wedo not particularlywant to encourage people to do it. If we though it was a good ideawe would implement an easier way to achieve it.So in that way, it is simply a business decision.But thatdecision hasa verypositive effect onour web serversstability and reliability.

    If you can find a .NET host that allows multiple or unlimited domains on an inexpensive account andhas been awarded Best ASP.NET Hosting Service by asp.netPRO Magazine for four years running, I'll buy you a year of hosting with them. ;)Those things are directly related. Every cost cutting measure comes at a price. We could promise the world, cut pricesand triple ourcustomer basein a few months, all the whiledelivering a degraded, crappyproduct. That is a cold - and common -fact of life in hosting. Of course everyone who enjoysour service for what it is now would flee, but they would easily be replaced by new customers whose standards are not as high. But we don't want to do that. So we have to have limitations.

    Sorry, rambling again. Carry on.
     
  7. No need to fear rambling. I appreciate the response. FWIW, 1&1 was recently chosen for the Readers Choice Award in Visual Studio Magazine, which is why I looked at them. I was just trying to confirm what my options are, and totest the impression I had received that this limitation is the norm in ASP.NET hosting.That doesn't necessarily mean I would go to 1&1, which is a bulk hosting provider; I'd much rather deal with a smaller company, and I like that your company markets to developers. I guess I'll have to keep looking if my options here are limited.

    Can I conclude from your response that I'm *not* going to be able to get this to work? Is that what you are saying?

    If I *can* get this to work, but it's a secret, that's doubly frustrating--especially if the information on how to do it has been deliberately scrubbed from these forums (and unfounded accusation on my part, to be sure...).

    If indeed I'm not going to be able toget it to work--and as you say, that is by design, a business decision you made--then I respect that; but I'll say I wish there was some way I could have been informed of that fact much sooner and much more explicitly. I guess I just didn't educate myself well enough before taking the leap.

    I suspose this works out great for everyone who needs exactly one web site, and, as you claim, the best service around. At $160 a year per web site (including database addon), that's a pretty high price to pay. If indeed you are telling me that this is not possible, or that you'd really prefer that I not do it, I'm afraid I will have to go elsewhere and take the risk of lesser service, even if that means being one of the faceless hordes at a bulk provider.

    Best,
    clubber
     
  8. mjp

    mjp

    No, I did not mean to suggest that it couldn't be done. A lot ofour usersdo it, and we do not make any attempt to hide their methods here in the forum. In fact you will probably see some DiscountASP.NET staff members posting in those threads.

    There is also an IIS 7 url rewrite module on the horizon (this is something that Apache has had forever, which is one of the reasons multiple domains on unix/linux is a simpler proposition). It is already available in fact, though I believe it isstillin a beta, or "technical preview"form. When it is ready forproduction environments we will doan evaluation andconsider implementation.
     
  9. If you say it can be done, I'm willing to keep plugging on it for awhile longer before giving up.I might be able to figure something out for myself by scouring books and other people's code, and if I get lucky, one of the people who have gotten this to work without resorting to Response.Redirect will see this thread and respond. Then again, I might wake up tomorrow and decide to just go somewhere I can set this up with the push of a button. I'm now two weeks behind on my project messing around with this, and the thought of spending a few more evenings and weekend afternoons trying to get this to work does not thrill me.

    FWIW, I've scoured these forums, and I can't find any information on how to get this to work. Most related posts are about subdomains, which is not what I'm trying to do. The only other thread I could find by someone looking to do exactly what I am trying to do petered out with no apparent resolution for the original poster.

    If I stick around as a customer and figurethis out, I'll surely post it here. I hate the idea of someone else going through this same exact thing I have been.

    Best,
    clubber




    Post Edited (clubber) : 8/18/2008 7:21:00 PM GMT
     
  10. To anyone following this thread or finding it in a search later: even though I have decided to leave DiscountASP.NET, I feel that they have acted honorably and treated me fairly.

    The root cause of my situation is that I failed to do enough research to figure out which hosting arrangement I needed, and signed up with one that obviously makes its many customers happy and comes highly recommended, but which didn't offer the right mix of features for me--the most important of which is to be able to easily set up multiple domains with separate roots and separate asp.net applications, a feature specifically not offered by DASP. Lesson learned on my part.

    Having taken a much deeper look at the ASP.NET hosting market, I realize that everyone offers a different mix of features--quite a diverse mix, actually. Tricky to find just the right match, and no bad mark against the ones that don't match.

    If you're trying to get the urlredirecting thing working as described above, keep plugging--I still had hope that I would be able to get this working, but I frankly didn't want to invest the time. Maybe someone will still reply down thread.

    clubber
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page