Connecting Tech Pros Worldwide Forums | Help | Site Map

Request.Url.GetLeftPart(UriPartial.Authority) - strange results

TimW
Guest
 
Posts: n/a
#1: Aug 19 '08
I'm having a problem on an ASP.NET 1.1 web site. The page where I'm having
a problem is accessed without SSL. It contains a link to another page which
can be configured to require SSL. If SSL is required, I change the URL of
the link from a relative URL to an absolute URL with HTTPS something like
this:

string newUrl =
Request.Url.GetLeftPart(UriPartial.Authority).Repl ace("http://","https://")
+ Response.ApplyAppPathModifier("/MyApp/Secure/MyPage2.aspx");

The GetLeftPart(UriPartial.Authority) is returning a completely different
domain name from the domain in the request:

The Request address is like http://www.MyCompany.org/MyApp/Page1.aspx.

The GetLeftPart expression is returning something like:

https://www.MyCompanysOtherSite.org/...ure/Page2.aspx.

If I enabling Trace for the www.MyCompany.org site, the trace information
says the server variable SERVER_NAME is www.MyCompanysOtherSite.org . There
is no reference in the application whatsoever to MyCompaniesOtherSite.org.

So it appears to me that there's something incorrect in the setup of the
MyCompany.org site, but this is beyond my expertise to explain or fix.

How does GetLeftPart(UriPartial.Authority) work, is it the wrong concept
here, what's happening?

Tim W.





Closed Thread