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

  • Home
  • SEARCH
  • 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 676795
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T00:58:07+00:00 2026-05-14T00:58:07+00:00

I have a method in a url rewriting module that looks like this public

  • 0

I have a method in a url rewriting module that looks like this

public bool Match(Uri url)
  {
      string x = url.PathAndQuery.ToLowerInvariant();
      string y = RuleData.ToLowerInvariant();

   return x.Contains(y);
  }

However, it is not returning true for the following values:

x = “/xx09-02-09xx”;
y = “09-02-09”;

but if I write a unit test with the raw strings, like below, it does return true

[Test]
        public void Contains()
        {
            string x = "/xx09-02-09xx";
            string y = "09-02-09";
            Assert.IsTrue(x.Contains(y)); // this returns true
        }

What could be the difference?
The encoding?
The culture?
Have tried removing the ToLowerInvarient(), but that makes no difference

have tried all the following in the Match method

bool contains = x.Contains(y);
bool contains1 = x.IndexOf(y) != -1;
bool contains2 = x.IndexOf(y, StringComparison.OrdinalIgnoreCase) != -1;
bool contains3 = x.IndexOf(y, StringComparison.InvariantCultureIgnoreCase) != -1;
bool contains4 = x.IndexOf(y, StringComparison.CurrentCultureIgnoreCase) != -1;

but none return true for those values, when run in the rewrite module. But they do in the unit test. So something about the strings is clearly different

any ideas?

  • 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-14T00:58:07+00:00Added an answer on May 14, 2026 at 12:58 am

    Have you verified that the hyphens in the two strings are in fact the same characters? I would examine the character codes for them in the debugger to rule out any tricks that the character set may play.

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

Sidebar

Related Questions

I have this method: public RasImage Load(Stream stream); if I want to load a
I have 1 website on IIS (myWebsite) and another inside this one (secondWebsite) as
i have a variable like /projects/3/blah blah or /projects/3 or just /projects What I'd
I have some code that uses JavaScript templates to create some HTML, including some
This seems like a pretty obvious, basic thing to expect from the Graph API
I have a partial view (ascx) for displaying the top x articles of a
I have a Rails application, and when I have Javascript errors they are not
I am using a third-party API (Spreadshirt's API) and in order to perform a
I am new to JavaScript OO programming please bear with me for any ambiguities.
I came up with an interesting way to solve the following problem and I

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.