Home > Mobile >  How to consume URL parameters using anchor
How to consume URL parameters using anchor

Time:11-05

I'm using Azure Function isolated .net 5 HttpTrigger.

How to consume URL 'parameters' when the parameters are passed using a '#' instead a '?'?

Example: https//some.sample.url/path#param1=someValue&param2=someOtherValue

I need the values:

param1=someValue;
param2=someOtherValue;

Background information:

https://www.rfc-editor.org/rfc/rfc6749 @ 4.2.2. Access Token Response:

For example, the authorization server redirects the user-agent by
   sending the following HTTP response (with extra line breaks for
   display purposes only):

 HTTP/1.1 302 Found
 Location: http://example.com/cb#access_token=2YotnFZFEjr1zCsicMWpAA
           &state=xyz&token_type=example&expires_in=3600

CodePudding user response:

No. On the azure functions server side, you will not be able to access anything after the # in the request URL.

The URL fragment identifier is meant to be used by the client(user-agent/browser). They are used for navigating to a specific sub section of the HTML document or other client-side user experience enhancements. If you try the URL https://www.bing.com/#foo=test&bar=test2 and observe the network traffic from the browser, you can see that anything after the fragment identifier (#) is not being sent to the server.

If you want to access some additional information on server side, consider sending them as query strings. Ex: https://www.bing.com?param1=someValue&param2=someOtherValue

  • Related