Stream Sign URL with C#

Does anyone know of any code, sdk or examples of signing url’s with C#? The documentation for Stream is not sufficient and I have been searching the next for better part of the day with no results.

I have the keys generated, just stuck at signing the url just before showing the video.

We don’t have a C# example. Have you considered using Cloudflare Worker for generating the signed URL? We have a code sample here that you can basically copy paste and adjust for your use:

Thank you. I did look at that example, but no sure how to consume the response from the worker in c# :slight_smile:

Do you have any examples of that?

By the way, if it helps, when I make the call to the utilities Cloudflare API I get a bad request error.

Thank you for your help.

Once you have a Worker, consuming it via .net is basically just a matter of making an HTTP request. Here’s a super quick example: C# PlayGround | C# Online Compiler | .NET Fiddle

Hi @zaid, thank you - this looks promising indeed. Am I right in saying that I cannot pass variables to the worker function?

Sorry for all the questions - the workers are pretty new to me.

Oh, you certainly can pass querystring parameters to your Worker. My example simply doesn’t use one.

For an example of how, see this example:

It is unrelated to signed URLs. But you can see how the example uses request.headers.get() to access querystring data.

You can do a lot more with Workers and I’d strongly encourage you to checkout the full docs:

The upside with using a Worker is that you don’t need to maintain any scripts that handle operations like signed URLs on your own server.