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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T15:21:19+00:00 2026-05-22T15:21:19+00:00

I am trying to send a request to an url like this http://mysite.dk/tværs?test=æ from

  • 0

I am trying to send a request to an url like this “http://mysite.dk/tværs?test=æ” from an asp.net application, and I am having trouble getting the querystring to encode correctly. Or maybe the querystring is encoded correctly, the service I am connecting to just doesn’t understand it correctly.

I have tried to send the request with different browsers and logging how they encode the request with Wireshark, and I get these results:

Firefox: http://mysite.dk/tv%C3%A6rs?test=%E6
Ie8:     http://mysite.dk/tv%C3%A6rs?test=\xe6
Curl:    http://mysite.dk/tv\xe6rs?test=\xe6

Both Firefox, IE and Curl receive the correct results from the service. Note that they encode the danish special character ‘æ’ differently in the querystring.

When I send the request from my asp.net application using HttpWebRequest, the URL gets encoded this way:

http://mysite.dk/tv%C3%A6rs?test=%C3%A6

It encodes the querystring the same way as the path part of the url. The remote service does not understand this encoding, so I don’t get a correct answer.

For the record, ‘æ’ (U+00E6) is %E6 in ISO-LATIN-1, and %C3%A6 in UTF-8.

I could change the remote service to accept the UTF-8 encoded querystring, but then the service would stop working in browsers and I am not really interested in that. Is there a way to specify to .NET that it shouldn’t encode querystrings with UTF-8?

I am creating the webrequest like this:

var req = WebRequest.Create("http://mysite.dk/tværs?test=æ") as HttpWebRequest;

But the problem seems to originate from System.Uri which is apparently used inside WebRequest.Create:

var uri = new Uri("http://mysite.dk/tværs?test=æ");
// now uri.AbsolutePath == "http://mysite.dk/tv%C3%A6rs?test=%C3%A6"
  • 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-22T15:21:20+00:00Added an answer on May 22, 2026 at 3:21 pm

    I ended up changing my remote webservice to expect the querystring to be UTF-8 encoded. It solves my immediate problem, the webservice can not be correctly called by both PHP and the .NET framework.

    However, the behavior is now strange in browsers. Copy pasting an url like “http://mysite.dk/tv%C3%A6rs?test=%C3%A6” into the browser and then pressing return works, it even corrects the encoded characters and displays the location as “http://mysite.dk/tværs?test=æ”. If then reload the page (F5) it still works. But if I click on the location bar and press return again, the querystring will become encoded with latin-1 and fail.

    For anyone interested here is an old Firefox bugreport about the problem: https://bugzilla.mozilla.org/show_bug.cgi?id=284474 (thanks to @dtb)

    So, it seems there is no good solution.

    Thanks to everyone who helped though!

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

Sidebar

Related Questions

I wrote REST service using ASP.NET Web API. I'm trying to send HttpDelete request,
I'm trying to send a http request from PLSQL. It works fine. HttpRequest :=
I'm trying to send a http get request in a php file to a
It seems like im getting a problem when Im trying to send a request
I'm trying to send a custom header to my web application using Google Http
Really having trouble trying to implement this in my controller. Essentially as it stands
I'm trying to send a HTTP POST request to a Google server and get
I'm trying to send a share content to my linkedin from my web application,
I am trying to request xml data from a e-commerce API in ASP classic
This might seem like a strange problem, but I am trying to send as

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.