Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do i get the url part after a "#" from HttpRequestBase

Tags:

asp.net-mvc

i am receiving GET requests like this

http://localhost/controller/List#SearchGuid=755d259d-e7c9-4c5a-bf2a-69f65f63df8d

and i need to read the SearchGuid which is after the #. unfortunately the HttpRequestBase seems the hide everything past a #.

does somebody know how i could still read the SearchGuid from within the controller action?

tia.

like image 447
marc.d Avatar asked Aug 28 '09 11:08

marc.d


People also ask

What comes after a in a URL?

A fragment is an internal page reference, sometimes called a named anchor. It usually appears at the end of a URL and begins with a hash (#) character followed by an identifier. It refers to a section within a web page.

What do you call the part of a URL after the slash?

Anything after the forward-slash is a “subdirectory.” Think of how you have a “Documents” folder, and you can have other folders under that. If domain.com refers to your top-level folder, domain.com/myproject refers to the “myproject” folder within it.

How do I find part of a URL?

window. location. pathname. split('/'); is a more elegant solution in most cases if you are trying to access the different sections of the URL beyod the standard protocol and www etc.


2 Answers

You can't, it doesn't get sent to the server.

like image 157
Noon Silk Avatar answered Sep 30 '22 19:09

Noon Silk


If you want to process url "fragments" (that's what those things after the '#' are called), you'll need to do so client side. Fragments are not transmitted to the server.

Either redesign the protocol to use a query string (replace '#' by '?'), or use javascript on the client to do the necessary processing - which may include making a server request that encodes the fragment in a URI query string.

like image 32
Eamon Nerbonne Avatar answered Sep 30 '22 19:09

Eamon Nerbonne