我需要组合两个url,但似乎UriBuilder不支持url中的../../。这是我手工编码的唯一选择吗?我正在尝试这样的东西:
Uri pageUri = new Uri("http://site.com/a/b/c.html");
string redirectUrl = "../../x.html";
UriBuilder builder = new UriBuilder(pageUri);
builder.Path += redirectUrl;感谢您提供的有关如何以正确的方式完成此操作的提示。
发布于 2009-12-28 18:52:27
您还可以使用:
Uri redirect = new Uri(
new Uri("http://site.com/a/b/c.html"), "../../x.html");发布于 2009-12-28 18:50:51
这对我来说工作得很好。你试着打电话给builder.Uri.OriginalString要回完整地址?
https://stackoverflow.com/questions/1968887
复制相似问题