我正在生成URI
如下(此代码已简化和伪造):
Uri baseUri = "http://localhost/MyApp/Account/Login";
Uri fullUri = GetFullUri(baseUri, user);
GetFullUri 看起来像这样(这是在 .NET 2 程序集中):
public Uri GetFullUri(Uri baseUri, User user)
{
string token = GetTokenFromUser(user); //Implementation not important.
//Create a new URI based on the base URI, adding a query string.
return new Uri(baseUri, string.Format("?Token={0}", token));
}
GetFullUri
从 .NET 4 程序集调用,结果是正确的,fullUri
如下所示:
http://localhost/MyApp/Account/Login?Token=ABC123
然后我从 .NET 2 程序集中调用了相同的确切代码,结果不正确,fullUri
如下所示:
http://localhost/MyApp/Account/?Token=ABC123
请注意 .NET 2 结果是如何缺少第 4 段也是最后一段“登录”?这有什么关系?