Question

I have a basu uri and a relative one that am try to create new one from. i did try the examples here, but there seems to be a bug. if i have a baseUrl as

http://ww.baseurl.com/somedir and i try to create an absolute path adding

/login.php or login.php using

uriReturn = New Uri(baseUri, relativeUri), i get

http://ww.baseurl.com/login.php instead of

http://ww.baseurl.com/somedir/login.php

what am i doing wrong?

Was it helpful?

Solution

There is no difference between http://ww.baseurl.com/somedir and http://ww.baseurl.com/somefile. Therefore, when you use a relative URI from that address, it will assume the file part of the URI is to be replaced. To indicate that somedir is a directory name, and be used as a base URI for the following queries, it should end with a slash: http://ww.baseurl.com/somedir/

OTHER TIPS

The first parameter in the Uri constructor is base URI, which is only the host portion, everything thereafter needs to be in the second parameter (including in your case "somedir").

uriReturn = NewUri(baseUri, "somedir/login.php")

See: http://msdn.microsoft.com/en-us/library/9hst1w91.aspx

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top