Letractively / dotnetkicks

Automatically exported from code.google.com/p/dotnetkicks
1 stars 0 forks source link

Modify Host functionality to support installation and debugging better #176

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Fresh install of DNK without any host records
2. Browse via localhost to view errors

What is the expected output? What do you see instead?
DNK fails without a host record.  And even when a host record exists, if 
you browse a DNK website within IIS (to view page errors), the host name 
(localhost) won't resolve the DNS host name (whateverkicks.com)

I submit that DNK should create a default host record if none exists for 
the current request.  This would help speed deployment greatly.

I also suggest implementing a host "alias" where requests coming from 
different domains can map to the same host record.  This would require 
refactoring the host table to remove the host name, which would then be 
placed in a second table in a one-to-many relationship.

Original issue reported on code.google.com by yesthatm...@gmail.com on 10 Dec 2007 at 4:17

GoogleCodeExporter commented 9 years ago
This is easily enough accomplished by editing the following with your sites - a
default host if you will...:

under host and hostprofile in kickpage.cs ->
get {
                if (this.Request.Url.ToString().IndexOf("newurlunknown") > 0)
                {
                    Uri nol = new Uri("http://urltohit.com");
                    return HostHelper.GetHostName(nol);
                }
                else
                {
                    return HostHelper.GetHostName(this.Request.Url);
                }
            }
}

hostprofile:
get
            {
                if (this._hostProfile == null)
                {
                    if (this.Request.Url.ToString().IndexOf("urlunknown") > 0)
                    {
                        Uri nol = new Uri("http://urltohit/");
                        this._hostProfile =
HostCache.GetHost(HostHelper.GetHostAndPort(nol));
                    }
                    else
                    {
                        this._hostProfile =
HostCache.GetHost(HostHelper.GetHostAndPort(this.Request.Url));
                    }
                }
                return this._hostProfile;
            }

I have successfully used this with multiple domains all pointing to one live.  
So in
the case of localhost you would use if !localhost hit localhost.  Simple as 
that.

I guess it ultimately depends on if you want your localhost db to be the same 
as your
remote db for testing/use.  I myself simply add the domains I need it use to the
above and have them point w/e I want.

Original comment by DustinBr...@gmail.com on 9 Jan 2008 at 5:38