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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T20:19:45+00:00 2026-05-11T20:19:45+00:00

I have an MVC route like this www.example.com/Find?Key= with the Key being a Base64

  • 0

I have an MVC route like this www.example.com/Find?Key= with the Key being a Base64 string. The problem is that the Base64 string sometimes has a trailing equal sign (=) such as:

huhsdfjbsdf2394=

When that happens, for some reason my route doesn’t get hit anymore.

What should I do to resolve this?

My route:

routes.MapRoute(
    "FindByKeyRoute", 
    "Find",
    new { controller = "Search", action = "FindByKey" }
);

If I have http://www.example.com/Find?Key=bla then it works.

If I have http://www.example.com/Find?Key=bla= then it doesn’t work anymore.

Important Addition:
I’m writing against an IIS7 instance that doesn’t allow % or similar encoding. That’s why I didn’t use UrlEncode to begin with.

  • 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-11T20:19:45+00:00Added an answer on May 11, 2026 at 8:19 pm

    EDIT: Original suggestion which apparently doesn’t work

    I’m sure the reason is that it thinks it’s a query parameter called Key. Could you make it a parameter, with that part being the value, e.g.

    www.example.com/Find?Route=Key=
    

    I expect that would work (as the parser would be looking for an & to start the next parameter) but it’s possible it’ll confuse things still.

    Suggestion which I believe will work

    Alternatively, replace “=” in the base64 encoded value with something else on the way out, and re-replace it on the way back in, if you see what I mean. Basically use a different base64 decodabet.

    Alternative suggestion which should work

    Before adding base64 to the URL:

    private static readonly char[] Base64Padding = new char[] { '=' };
    ...
    base64 = base64.TrimEnd(Base64Padding);
    

    Then before calling Convert.FromBase64String() (which is what I assume you’re doing) on the inbound request:

    // Round up to a multiple of 4 characters.
    int paddingLength = (4 - (base64.Length % 4)) % 4; 
    base64 = base64.PadRight(base64.Length + paddingLength, '=');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Currently, I have URLs that look like this: http://www.example.com/user/create http://www.example.com/user/edit/1 But now, I have
I have a route in my asp.net mvc 2 site that looks like this
I created a route in ASP.net MVC application that looks like this: routes.MapRoute( ArticleRoute,
a have a problem with ASP.net MVC url routing. I have created this route
If I have an Action like this: public ActionResult DoStuff(List<string> stuff) { ... ViewData[stuff]
Due to factors outside my control, I need to handle urls like this: http://www.bob.com/dosomething.asp?val=42
I have a controller that looks like this: public ActionResult Sold() { using (WipDBEntities
Say I want to display user details like so: http://www.mysite.com/user/1 I set a route
I want to set up a ASP.NET MVC route that looks like: routes.MapRoute( Default,
I have an action like this: public class News : System.Web.Mvc.Controller { public ActionResult

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.