Hi @fatih uyanık , Welcome to Microsoft Q&A,
You can try adding cache-control headers to your HTTP requests to instruct servers and intermediaries not to cache responses.
using System;
using System.Net.Http;
using System.Threading.Tasks;
class Program
{
static async Task Main(string[] args)
{
string gistRawUrl = "https://gist.githubusercontent.com/username/gistid/raw";
try
{
using (HttpClient client = new HttpClient())
{
// Add cache-busting headers
client.DefaultRequestHeaders.Add("Cache-Control", "no-cache");
client.DefaultRequestHeaders.Add("Pragma", "no-cache");
// Append a timestamp to the URL as a query parameter to bypass cache
string urlWithTimestamp = $"{gistRawUrl}?_={DateTimeOffset.UtcNow.ToUnixTimeMilliseconds()}";
string content = await client.GetStringAsync(urlWithTimestamp);
Console.WriteLine("Gist content:");
Console.WriteLine(content);
}
}
catch (Exception ex)
{
Console.WriteLine($"An error occurred: {ex.Message}");
}
}
}
Best Regards,
Jiale
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.