Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get full URL with hash to use as ReturnUrl

I have such URL

localhost/Login/LogOn?ReturnUrl=/#&q=my%20search%20word&f=1//447044365|2//4

I need to get hash parameters to navigate in the application after authentication.

I try to catch it like this

<input name="returnUrl" value="<%= ViewContext.HttpContext.Request.Url.PathAndQuery %>" type="hidden" />

But result is

/Login/LogOn?ReturnUrl=/

I tried to take away "/#" in the URL, then I get whole URL. But I need to use this URL as it is.

Why was URL cutted?

like image 594
podeig Avatar asked Apr 04 '11 09:04

podeig


People also ask

How do I add a hash to a URL?

The hash of a url can be found by creating a new URL Javascript object from the URL string, and then using its hash property to get the value of the hash fragment. Note that this will include the # character also. If the url does not contains a hash, then an empty string "" will be returned.

How do I know if a URL has a hash?

Answer: Use the Window. location Property You can simply use the location property of a window (i.e. window. location ) to check whether a URL contain hash ( # ) or fragment component or not in JavaScript.

What is Hash URL?

In a URL, a hash mark, number sign, or pound sign ( # ) points a browser to a specific spot in a page or website. It is used to separate the URI of an object from a fragment identifier. When you use a URL with a # , it doesn't always go to the correct part of the page or website.


1 Answers

The browser does not send the hash fragment to the server. It used on the client-side only. If you need it you will have to access it through client-side script.

like image 72
Talljoe Avatar answered Oct 13 '22 08:10

Talljoe