I found UriBuilder weird behavior in .NET
Senario 1:
Dim uri As New UriBuilder("http://www.test/login.aspx") uri.Query = "?test=Test" Dim url As String = uri.ToString()
After running this code, the url line contains "http: //www.test/login.aspx ?? test = Test"
The solution was to not add ?.
Senario 2:
Dim uri As New UriBuilder("http://www.test/login.aspx?test=123") uri.Query += "&abc=Test" Dim url As String = uri.ToString()
After this code, do we have two again? "HTTP: //www.test: 80 / login.aspx ?? test = 123 & abc = Test."
So am I doing something wrong when using the uri builder?
Peter source share