3

Possible Duplicate:
How to get Url Hash (#) from server side

I'm having some trouble to get the hash value from a variable.

I'm using the default action in the AccountController

[HttpPost]
public ActionResult LogOn(LogOnModel model, string returnUrl) { ... }

but if I pass this link on:

http://localhost:1357/none/Account/LogOn?returnUrl=a/b/c#day-22

I can never catch the #day-22 value

below it's a breakpoint after the login:

enter image description here

I never get the hash value on the HttpContext.Request.Url object.

What can I do to forward the user to the correct URL with the hash part?

Community
  • 1
  • 1
balexandre
  • 73,608
  • 45
  • 233
  • 342

3 Answers3

5

You need to urlencode it.

Try: http://localhost:1357/none/Account/LogOn?returnUrl=a/b/c%23day-22

drch
  • 3,040
  • 1
  • 18
  • 29
2

This is not possible because the URL fragment (the bits after the #) is not sent from the browser to the server.

João Angelo
  • 56,552
  • 12
  • 145
  • 147
1

Use HttpUtility.UrlEncode and HttpUtility.UrlDecode while forming/resolving that part.

L.B
  • 114,136
  • 19
  • 178
  • 224