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#BFTThe 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);
}
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
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
Method 2
It’s not possible to retrieve the #anchor from the server side in ASP.NET
This is a client-side flag to tell the browser to move to a specific place within the page.
Please take a look at this same discussion
Retrieving Anchor Link In URL for ASP.Net
and
Get full URL with hash to use as ReturnUrl
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0