Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8709057
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T04:16:28+00:00 2026-06-13T04:16:28+00:00

It blew my mind when I found that Uri tostring breaks uris…. Here is

  • 0

It blew my mind when I found that Uri tostring breaks uris…. Here is an example

If you run this in immediate mode you’d get

new Uri("http://site.com?a=1&b=c%26d").AbsoluteUri

Res

"http://site.com/?a=1&b=c%26d"

But

new Uri("http://site.com?a=1&b=c%26d").ToString() //string.format i believe doesn't need .ToString()

Gets me

"http://site.com/?a=1&b=c&d"

The b value is completely broken. I was shocked. Am I never to use ToString()? This seems like a bug. But writing this question gave me the answer (.AbsoluteUri). But maybe this will help someone.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T04:16:29+00:00Added an answer on June 13, 2026 at 4:16 am

    The Uri.ToString method isn’t useful for anything other than to display the URI in a human friendly way.

    From the code example on the documentation for Uri.ToString:

    // The following outputs "http://www.contoso.com/thick and thin.htm".
    Console.WriteLine(uriAddress.ToString());
    
    // The following outputs "HTTP://www.Contoso.com:80/thick%20and%20thin.htm".
    Console.WriteLine(uriAddress.OriginalString);
    

    The example shows that the ToString method returns a string with spaces, which is not a character that is valid in an URI. The string representation of the Uri is clearly not intended to be used as an actual URI. This fact should perhaps be made more clearly in the documentation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I saw this in code. It blew my mind. <% if (false) { %>
Haskell blew my mind yet again when I realised that (x,y) Is just syntactic
Eclipse just blew my mind again: there seems to be no easily accessible way
In another question , someone mentioned this site which blew me away: http://zoomii.com Does
I think I blew you away by the title. But here's what I exactly
I've seen some softwares which just blew me away, that had incredible look. so
HI. I want a function in java that automatically called. for example wen we
In glibc malloc.c or dlmalloc It said repositioning tricks As in blew, and use
In this I need C++ array class template, which is fixed-size, stack-based and doesn't
Sorry for the semi-rant here. I am hooked on javascript and want some direction

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.