0

Further to my question at How do write a rewrite rule in IIS that allows HTML anchors? I was wondering if I can do the following or alternatively if there is a similar option to what is available in Apache e.g. mod_rewrite with anchor link

<match url="^ts\/tcs\.aspx$" />
<action type="Redirect" url="http://www.abc.com" />
<conditions>
   <add input="{UrlEncode:{URL}}" pattern="#" />
</conditions>
Community
  • 1
  • 1
PeanutsMonkey
  • 6,919
  • 23
  • 73
  • 103
  • IIS7 provides a nice, integrated means to test your regular expressions when you set them up in the `Edit Inbound Rule` page. – Kirk Woll Aug 01 '11 at 22:05
  • @Kirk Woll - I tried that but it doesn't allow me to test encoded values – PeanutsMonkey Aug 01 '11 at 22:16
  • 2
    Once again -- everything after the hash (including that symbol) will NOT be sent to a server (it is client-side ONLY), therefore you cannot match it in any way. – LazyOne Aug 01 '11 at 22:19
  • @LazyOne - Is that limited to just IIS or Apache as well? – PeanutsMonkey Aug 01 '11 at 22:21
  • @LazyOne - When you say `hash (including that symbol)` what is the difference between hash and the symbol? – PeanutsMonkey Aug 01 '11 at 22:22
  • 1
    Any web server -- the browser itself should not send it to a server in first place. Of course -- if you send such request manually via code and corresponding function/class/component does not strictly follow standards, then it may get sent and then you will have it as part of query string (but the web server _may_ reject such request). – LazyOne Aug 01 '11 at 22:24
  • 1
    If URL is: `/something.php?task=show#kitten`, then `#kitten` is the hash (including the actual hash symbol `#`). The proper name of `kitten` here is [Fragment Identifier](http://en.wikipedia.org/wiki/Fragment_identifier). – LazyOne Aug 01 '11 at 22:30
  • @LazyOne - Happy to award your reply as an answer if you post it as an answer – PeanutsMonkey Aug 01 '11 at 22:42

1 Answers1

0

Here we go:

Everything after the hash (including the hash symbol itself) will NOT be sent to a server (it is client-side ONLY), therefore you cannot match it in any way.

It is not IIS restriction -- any web server does (better say, should do) the same -- the browser itself should not send it to a server in first place. Of course -- if you send such request manually via custom code (PHP, ASP.NET etc) and corresponding function/class/component does not strictly follow standards, then it may get sent and then you will have it as part of query string (but the web server may reject such request, although unlikely).

If URL is: /something.php?task=show#kitten, then #kitten is the hash (including the actual hash symbol #). The proper name of kitten here is Fragment Identifier.

LazyOne
  • 158,824
  • 45
  • 388
  • 391