views:

20

answers:

0

How things works (or should):

We have lots of clients apps set on IIS but Apache is the one that receives all conections (from port 443) and redirect them to the corresponding port on the IIS server.

The problem is: our application is building the URLs based on the IIS port (final port) instead of Apache's (default 443) one, even tho there's no code "explicitly" saying to work this way.

Example:

If theres a link that should be https:www.myaccountinformation.com/Site/PageOne the URL is being built as https:www.myacountinfo.com:448/Site/PageOne.

Heres some of the code:

        if(some condition)
        {
            uri = new UriBuilder();
            uri.Scheme = SchemeURI;
            uri.Host = Dominio;
            uri.Port = Porta; //always set to default
            //string pathandquery = (apppath + arquivoePath).Replace("//", "/");
            string pathandquery = (apppath + arquivoePath);
            if (pathandquery.StartsWith(@"//")) pathandquery = pathandquery.Substring(1, pathandquery.Length - 1);
            **uri = new UriBuilder(new Uri(uri.Uri, pathandquery));**
        }
        else
        {
            if (apppath == "/") apppath = string.Empty;
            **uri = new UriBuilder(new Uri(context.Request.Url, apppath + arquivoePath));**
        }

Uri port is always being set as default ones (443 or 80 for http).

Is there a way of making the Uribuilder ignore IIS port and do not add it after the default application path?

Regular links are working fine. The problem appears only in a few HTTPS links.

Hope you understand, english aint my best language.

Thanks in advance!