I cant get the full url of the page that I am working on. This is the url that I want to get http://localhost:54570/Shipment/ShipmentDetails.aspx?HawbBLNo=NEC00000004#BFT
The result is only http://local/Shipment/ShipmentDetails.aspx?HawbBLNo=NEC00000004
on this code
protected void btnSave_Click(object sender, EventArgs e)
{
url = HttpContext.Current.Request.Url.AbsoluteUri;
UpdateDetails();
Response.Redirect(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.
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.
The fragment identifier introduced by a hash mark # is the optional last part of a URL for a document. It is typically used to identify a portion of that document.
To sum up: Only one "#" is allowed in a compliant URL (or URI) as the marker for the URL-fragment. Especially hash signes that are supposed to be in the path (at least from the looks, as there are slashes afterwards) are problematic as they officially terminate the path part.
there is no way to get hash content on server side because hash are never posted to the server
see this question for some tricks How to get Url Hash (#) from server side
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With