All Questions
Tagged with cache-control c#
33 questions
-1
votes
3
answers
370
views
define cache-control header in a json object in C#
I need to post a batch API request from a C# code. In one of the requests in the batch, I need to set Cache-Cotrol to no-cache. The request body should be like this:
request body in postman
{
"...
1
vote
0
answers
275
views
Blazor client-side - DLLs not cached
I created a simple Blazor app using the WebAssembly approach in .NET 6.
However, every-time I visit the website, it takes several seconds to load. About 8.5MB of data and over 50 files, most of which ...
1
vote
1
answer
4k
views
How To Use .NET Core ResponseCaching
I have a .NET Core Web API that simply fetches some data from a database. I want to use some caching solution to prevent going database for every request and also to increase performance. I followed ...
1
vote
1
answer
392
views
How to avoid different user use the same cache data?
I have a server in ASP.NET and a web server in JS.
The API server will add a cache-control header for each GET method and set the expire time, so the web will not consume twice within that period ...
2
votes
0
answers
899
views
Cache Control on wwwroot subfolders Net core 2.2
I'm trying to add cache control headers to .js and .css files which live in wwwroot/dist. If I output my files directly into wwwroot rather than wwwroot/dist (from webpack) the headers are added ...
1
vote
0
answers
235
views
How to add s-maxage to Web,Config Cache Profile
I would like to create multiple Cache Profiles in my Web.Config for different types of pages in my web application. For example, data forms do not change often so I would increase the Cache-Control ...
3
votes
1
answer
4k
views
HTTP Client NoCache Flag Cause Null Reference Exception C# [duplicate]
I added this line to apply no caching in HTTP Client
HttpClient httpClient = new HttpClient();
httpClient.DefaultRequestHeaders.CacheControl.NoCache = true;
When i run the app which was working fine ...
1
vote
1
answer
2k
views
Antiforgery and cache-control header ASP.NET core
I am trying to override cache-control header set by default antiforgery of asp.net core 2.0
.net core always sets it to no-cache, no-store. I am trying to use private which actually works as I wanted....
3
votes
2
answers
3k
views
Best practice of Cache-Control for Bad Request (400)
Currently I have the following action which will tell the client to cache the response for 1200 seconds:
[ResponseCache(Location = ResponseCacheLocation.Client, Duration = 1200)]
[HttpGet("...
0
votes
1
answer
1k
views
C# WebRequest (400) Bad Request on second call
I'm trying to check our SSL certificates with a program but i have an issue; i can not use second HttpWebRequest because of something which i don't know. I supposed it's a cache problem and used all ...
0
votes
0
answers
295
views
ASP.Net Session inconsistencies with Cache-Control
We are facing a strange issue with ASP.Net session state. We have a legacy application for browsing user accounts that uses session state to store some objects, like the currently opened account ...
2
votes
1
answer
90
views
How to control page's cacheability after login action
I have this code:
Response.Cache.SetExpires(DateTime.Now.AddMinutes(60));
Response.Cache.SetCacheability(HttpCacheability.Public);
I'm trying to cache the entire page on client's browser and any ...
5
votes
1
answer
2k
views
How to undo Response.Cache.SetNoStore()?
I've a CMS application code which calls Response.Cache.SetNoStore() on all request and if i'm correct, this will be prevents proxies/cdn to cache those pages/content. Therefore, i'm conditionally ...
33
votes
3
answers
60k
views
Cache-control: no-store, must-revalidate not sent to client browser in IIS7 + ASP.NET MVC
I am trying to make sure that a certain page is never cached, and never shown when the user clicks the back button. This very highly rated answer (currently 1068 upvotes) says to use:
Response....
7
votes
2
answers
25k
views
How to clear browser cache when user log off in asp.net using c#?
As new in asp.net. In my asp.net application in membership in log off on click event using function ClearSession(), but problem arises after log off if i click back button on browser it is forwarding ...