0

How to route url contains # sharp character like this: ~/page.aspx#/Home to be: ~/Home

cjinojl
  • 21
  • 2

2 Answers2

4

The # in a URL refers to a named anchor (<a name="xxx" />) tag and does not get passed through to the server.

~/page.aspx#/Home refers to the anchor named /home on the page page.aspx.

The server will only get the request to page.aspx and anything from the # onwards will not be passed through.

See this SO question and answers.

In other words - do not use the # character in your URL if they do not refer to a named anchor within the document, as you will not be able to get these routed in the server.

Community
  • 1
  • 1
Oded
  • 489,969
  • 99
  • 883
  • 1,009
0

I think Oded has the right answer here.

But if you happen to have a situation where the # is in user entered data, you should URL escape it before putting it in the URL.

#/Home would then be %23/Home

However, I get the feeling this isn't actually the case here.

David Hogue
  • 1,791
  • 1
  • 14
  • 23