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 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 a method that looks like this function endcall_click(leadid) { document.location = '@Url.Action(index,dispo,new{id=leadid})/';
I have a method like so private bool VerbMethod(string httpVerb, string methodName, string url,
I have POST method like this public void PostMethod([FromBody]string param) { var test =
In ASP.NET MVC I have a controller that looks somehow like this: public class
I have to map a REST Webservice URL like http://server:8080/application/service/customer/v1 to createCustomer method in
I have a method that pulls a url name(varchar), a urlID(int) and its Enabled
Need help parsing... In my code, I have a method that returns url.getHost();. But
I have a method that downloads an image from a given URL. Is it
I have this method: - (void)postDictionary:(NSDictionary *)dictionary toURL:(NSURL *)url forDelegate:(id)delegate withIdentifier:(NSString *)identifier; I want
All is title :) I have this method : [[NetworkManager sharedInstance] getContentFromUrl:url withId:@json onResultBlock:^(NSData

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.