简体   繁体   中英

'#' letter is missing in HttpContext.Request or HttpContext.Current.Request url?

My URL is: http://localhost/myApp/app/job/7#/Nmbr

When I tried to get the URL from HttpContext.Request or HttpContext.Current.Request, the given url is : /myApp/app/job/7

# and everything after this letter are missing? Why? How can I get the real current url?

Http requests do not include anything after # (The browser does not send it with the request.)

# Is intended to allow for parameters to be specified for the browser only (Anchor target location, or with often with web 2.0 JavaScript parameters)

In order to pass parameters to the server use ? that appears before the #

Here is some information regarding fragments (The part of the URL after # )

The Fragment property gets any text following a fragment marker (#) in the URI, including the fragment marker itself. Given the URI http://www.contoso.com/index.htm#main , the Fragment property would return #main.

https://msdn.microsoft.com/en-us/library/system.uri.fragment(v=vs.110).aspx

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM