0

I am writing a web app that has to deal with urls containing hash character ("#"). I am using MVC 1 with ASP.NET 3.5 (VS 2008). My urls are like this one:

www.mysite.com/token/?name1=value1&#&name2=value2

My issue is that I cannot find a method to get the original URL, but only get the substring before the hash character:

www.mysite.com/token/?name1=value1&

I used the MVC methods provided from the class HttpRequestBase.

Anyone can suggest me an alternate method to get the entire url? Thank you, this is my very first question!

PS: I think maybe I have to encode my hash character, isn'it?

ekad
  • 14,436
  • 26
  • 44
  • 46
Cristian
  • 1
  • 1
  • 2
  • Why are you trying to get information out of the URL? If your view needs information, it should be passed through the model by the controller. – Kyeotic Aug 26 '11 at 15:55
  • I don't want to pass informations to the view, but I want to create URL with new names&values, but I want these information put after the hash character '#'. – Cristian Aug 30 '11 at 15:25
  • What are you doing with this information? Are you collecting in the controller for routing purposes? – Kyeotic Aug 31 '11 at 14:43

1 Answers1

0

You cannot access anything after the # from the server-side - this is all Client-side. You will need to find another way to pass the information you want through to the server.

If you are posting, you can do this with hidden fields. If you are using ajax posts, you can pass the data within the model.

Richard
  • 29,854
  • 11
  • 77
  • 120