Wrong hostname and port

May 8, 2009 at 8:16 AM

Hi, I have a problem with my BE .NET installation. I have a local server with Win 2k3 and IIS 6.0. When I access the site via my local address like myserver:83 everything works fine. If i use a external address ( via virtual server in my router ) for example http://www.myserver.de I get the page also.

But the links of E-Mail, Kick It! .... are shown as http://www.myserver.de:83/... that doesn't make any sense.

Any ideas how to supress this?

regards

Levi

Coordinator
May 8, 2009 at 10:47 AM

So is your website bound to port 80 or 83?  If 80 works, then you shouldn't need to include 83 in the URL?

If you re-start your blog application and don't access it as myserver:83, chances are you won't see the 83 in the links.

Also, the Kick It! link is usually something like http://www.dotnetkicks.com/... and the E-Mail link is mailto:?subject=...  You're seeing links back to your server for Kick It! and E-Mail It?

May 8, 2009 at 3:00 PM

Hi, thanks for quick answer:

The server is bounded to port 83. My router redirect the port 80 ( extern ) to port 83 ( intern ). If I access it from extern there is no port needed in the urls because it's port 80. But it is in ( maybe ) because i hosted it intern on port 83. But the url is external so it's something true and something false.

Extern:

http://www.myserver.de                 host: www.myserver.de         port:80       schould be: http://www.myserver.de             is: http://www.myserver.de:83            < false

Intern:

http://myserver                                 host: myserver                         port:83       schould be: http://myserver:83                         is: http://myserver:83                            < true

 

You know what I mean?

And Kick it! and eMail: The problem is not the target but what is sent. If i use eMail it's a function to send the articel to a friend. The url pasted in is http://www.myserver.de:83( from extern, it's wrong )

Levi

Coordinator
May 8, 2009 at 7:54 PM

Thanks for the explanation.  The simplest way to remove the :83 will be to make a small modification to the BE Core code and re-compile.

In the BE core code, there's a Utils.cs file with a AbsoluteWebRoot property.  The code for it is below (minus some old commented out code).  If you add the bolded part shown below, the :83 should be removed from all these links.

public static Uri AbsoluteWebRoot
{
    get
    {
        HttpContext context = HttpContext.Current;
        if (context == null)
            throw new System.Net.WebException("The current HttpContext is null");

        if (context.Items["absoluteurl"] == null)
            context.Items["absoluteurl"] = new Uri(context.Request.Url.GetLeftPart(UriPartial.Authority).Replace(":83", string.Empty) + RelativeWebRoot);

        return context.Items["absoluteurl"] as Uri;
    }
}