Hostname and wildcards

3 posts, 1 answers
  1. nasekt
    nasekt avatar
    40 posts
    Member since:
    Aug 2014

    Posted 20 Oct 2014 Link to this post


    if (oSession.HostnameIs("www.google.co.uk") && oSession.uriContains("query")){
    oSession["ui-color"]="orange";
    oSession["ui-bold"]="true";
      oSession.oRequest.FailSession(404, "Blocked", "Fiddler blocked  file");}

    The above script blocks only  www.google.co.uk, It does'nt work if there it's a different country code domain

    for example 
    www.google.co.br
    www.google.co.cm

    I tried using wildcards *.google.*, but it does not work. Any ideas?

    Thank you
  2. Answer
    Eric Lawrence
    Admin
    Eric Lawrence avatar
    833 posts

    Posted 20 Oct 2014 Link to this post

    StackOverflow.com is a great place to ask general programming questions like "How do I perform a wildcard comparison of strings."

    While domain names are much more complicated than you might expect, a simple approach would be for you to use:

      if (oSession.hostname.Contains(".google.")) { doWhatever(); }

    Regards,
    Eric Lawrence
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. nasekt
    nasekt avatar
    40 posts
    Member since:
    Aug 2014

    Posted 20 Oct 2014 in reply to Eric Lawrence Link to this post

    Sorry about that, I will keep that in mind 

    Again, Thank you for helping me.
Back to Top