Option to display full URL for .EndpointBaseUrl?

Regalado, Dominique 0 Reputation points
2023-11-13T21:29:32.9833333+00:00

Hi,

I've implemented your WebHookEventSubscriptionDestination class and I've noticed when subscribing to events, the sdk is truncating the full URL when it contains a "?". How can we include the entire URL even with special characters like this?

For Reference - https://learn.microsoft.com/en-us/dotnet/api/microsoft.azure.management.eventgrid.models.webhookeventsubscriptiondestination?view=azure-dotnet-legacy

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
3,725 questions
{count} votes

1 answer

Sort by: Most helpful
  1. JananiRamesh-MSFT 15,396 Reputation points
    2023-11-14T17:40:15.9033333+00:00

    @Regalado, Dominique Thanks for reaching out. If the URL is being truncated at the “?” character, it’s likely because the “?” character is a reserved character in URLs and is used to indicate the start of a query string. If you need to include a “?” character as part of the URL itself you should URL encode it. In URL encoding, the “?” character is represented as “%3F”.

    Here’s how you can do it in C#:

    string url = "https://example.com/myendpoint?";
    string encodedUrl = System.Net.WebUtility.UrlEncode(url);
    

    The encodedUrl variable will contain the encoded URL, which you can then use with the WebHookEventSubscriptionDestination class to subscribe to events.

    Please try and let me know incase of further queries, I would be happy to assist you.

    0 comments No comments