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

The Archive Base Latest Questions

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

Why do the following URLs give me the IIS errors below: A) http://192.168.1.96/cms/View.aspx/Show/Small+test ‘

  • 0

Why do the following URLs give me the IIS errors below:

A) http://192.168.1.96/cms/View.aspx/Show/Small+test‘

A2) http://192.168.1.96/cms/View.aspx/Show/Small%20test‘ <– this works, but is not the result from HttpUtility.UrlEncode()

B) http://192.168.1.96/cms/View.aspx/Show/‘%26$%23funky**!!~”+page

Error for A:

HTTP Error 404.11 - Not Found
The request filtering module is configured to deny a request that contains a double escape sequence.

Error for B:

HTTP Error 400.0 - Bad Request
ASP.NET detected invalid characters in the URL.

The last part of the URL after /Show/ is the result after the text is being sent through HttpUtility.UrlEncode() so, according to Microsoft it is URL Encoded correctly.

If I user HttpUtility.UrlPathEncode() rather than HttpUtility.UrlEncode() I get the A2 results. But B ends up looking like:

http://192.168.1.96/TVCMS-CVJZ/cms/View.aspx/Show/‘&$#funky**!!~”%20page

which is still wrong. Does Microsoft know how to URL Encode at all? Is there a function someone has written up to do it the correct way?

EDIT:

I’ve written my own encoder:

static public string UrlEncode(string encode)
{
    if (encode == null) return null;
    string encoded = "";

    foreach (char c in encode)
    {
        int val = (int)c;
        if ((val >= 48 && val <= 57) || (val >= 65 && val <= 90) || (val >= 97 && val <= 122))
            encoded += c;
        else
            encoded += "%" + val.ToString("X");
    }

    return encoded;
}

The function works with A2 above just fine the result for B is:

http://192.168.1.96/cms/View.aspx/Show/%27%26%24%23funky%2A%2A%21%21~%27%27%20page

But even though that looks like a nice valid URL IIS still gives me a

HTTP Error 400.0 – Bad Request
ASP.NET detected invalid characters in the URL.

  • 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-19T00:22:48+00:00Added an answer on May 19, 2026 at 12:22 am

    OK, answering my own question… hate doing it but I got the answer after much digging.

    http://www.lostechies.com/blogs/joshuaflanagan/archive/2009/04/27/asp-net-400-bad-request-with-restricted-characters.aspx

    The long and short of it is the Microsoft in all its glory decided not to stick to a international standard, again.

    %, &, *, or : can not be in a URL, encoded or decoded before a ? for any reason.

    To get around this I’ve written my own encode and decode:

    static public string UrlEncode(string encode)
    {
        if (encode == null) return null;
        string encoded = "";
    
        foreach (char c in encode)
        {
            int val = (int)c;
            if (val == 32 || val == 45 || (val >= 48 && val <= 57) || (val >= 65 && val <= 90) || (val >= 97 && val <= 122))
                encoded += c;
            else
                encoded += "%" + val.ToString("X");
        }
    
        // Fix MS BS
        encoded = encoded.Replace("%25", "-25").Replace("%2A", "-2A").Replace("%26", "-26").Replace("%3A", "-3A");
    
        return encoded;
    }
    
    static public string UrlDecode(string decode)
    {
        if (decode == null) return null;
        // Fix MS BS
        decode = decode.Replace("-25", "%25").Replace("-2A", "%2A").Replace("-26", "%26").Replace("-3A", "%3A");
    
        return HttpUtility.UrlDecode(decode);
    }
    

    Neither of the functions are Unicode friendly at the moment, but for now it works.

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

Sidebar

Related Questions

Please consider the following URLs: http://www.mydomain.com/a/test.php https://www.mydomain.org/a/b/test.php http://www.mydomain.co.nr/a/b/c/test.php https://www.mydomain.com/a/b/c/d/test.php http://www.mydomain.co.uk/a/b/c/d/e/test.php https://www.mydomain.co.au.nm/a/b/c/d/e/f/test.php?var1=test1&var2=test2 Now I want
I have the following URLs with the same content: http://www.mysite.com/forum/viewthread.php?thread_id=39&pid=1349 http://www.mysite.com/forum/viewthread.php?forum_id=2&thread_id=39 Which at the
I'm trying use mod_rewrite to rewrite URLs from the following: http://www.site.com/one-two-file.php to http://www.site.com/one/two/file.php The
I want to know which of the following urls is best to use: http://www.website.com/index.php?i=123
Consider the following URLs http://m3u.com/tunein.m3u http://asxsomeurl.com/listen.asx:8024 http://www.plssomeotherurl.com/station.pls?id=111 http://22.198.133.16:8024 Whats the proper way to determine
in my site i need process the following urls: http://localhost/groups/ {id_group} localhost/groups/{id_group}/events localhost/groups/{id_group}/events/{id_event} localhost/groups/{id_group}/events/{id_event}/galery
I need to setup the following urls: /article (article#index) /articles/1234 ( article#show with id
I have the following URLs for my ASP.Net MVC 2 site: http://localhost:1919/TimeEntry/SummaryForWeek/15/2011 http://localhost:1919/TimeEntry/SummaryForMonth/4/2011 Both
I am using CodeIgniter on PHP and it produces the following URLs: http://my.domain.com/app/index.php?/admin/main/ the
I'm trying to get mod_rewrite working with the following URLs: /events.php?view=details&id=$var /events.php?view=edit&id=$var Obviously my

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.