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 6476397
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:49:13+00:00 2026-05-25T06:49:13+00:00

Suppose I want to create an Uri object from the following string: string url

  • 0

Suppose I want to create an Uri object from the following string:

string url = @"http://someserver.com?param1=1&url=http%3a%2f%2fwww.otherserver.com";
Uri uri = new Uri(url, UriKind.Absolute);

Expected result would be:

http://someserver.com?param1=1&url=http%3a%2f%2fwww.otherserver.com 

Obtained:

http://someserver.com/?param1=1&url=http://www.otherserver.com

The same behavior is noticed in many related methods that allow Uri creation: Uri.TryCreate, UriBuilder.Uri, etc.

How would I get an Uri that preserve initial encoded parameter?

  • 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-05-25T06:49:14+00:00Added an answer on May 25, 2026 at 6:49 am

    This behavior is documented:

    As part of canonicalization in the constructor for some schemes,
    escaped representations are compacted. The schemes for which URI will
    compact escaped sequences include the following: file, http, https,
    net.pipe, and net.tcp. For all other schemes, escaped sequences are
    not compacted. For example: if you percent encode the two dots “..” as
    “%2E%2E” then the URI constructor will compact this sequence for some
    schemes. For example, the following code sample shows a URI
    constructor for the http scheme.

    So one workaround might be temporarily using a custom scheme (e.g. leavemealone://) to construct the URL objects (possibly through UriBuilder?).

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

Sidebar

Related Questions

Suppose I want to get student summaries from a two tables: student, grade: CREATE
Let's suppose I want to create a javascript class/object/function which have a method that
I want to create an image object from scratch. Here is the idea: var
Suppose I want to create a set of observers based on type. That is
I want to create sub-domains using PHP on the fly. Suppose a user registers
Suppose I want to create my own desktop envoriment for Linux, without X. Like
Suppose I want to create a (stateless) WCF service with three methods exposed on
Suppose I want to create a select box in PHP. $months = array ('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');
Suppose I want to create an abstract class in Python with some methods to
Suppose I have an immutable NSArray and want to create several sub-arrays. I could

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.