Apache redirect and set cache headers?
288
Try adding the "always" condition to your Header directive, so it should look like this:
Header always set Cache-Control max-age=0
Header always set Expires "Thu, 01 Dec 1994 16:00:00 GMT"
This should work, without the "always" condition I believe it defaults to "onsuccess" which is defined as any 2xx response code.
Related videos on Youtube
Author by
Rémi
Updated on September 17, 2022Comments
-
Rémi over 1 year
I have the following piece of code :
private List<KeyValuePair<int, string>> _list = new List<KeyValuePair<int, string>>(); public MyclassConstructor() { foreach (Enum value in Enum.GetValues(typeof(FontStyle))) _list.Add(new KeyValuePair<int, string>((int)value, value.ToString())); }
I can't figure out how to get the int part of this enum as the key... pretty dumb question I'm sure but I can't get it working.
I was refering to this article up here on stackoverflow but as you can see this doesn't work
So how can I get the int value of the enum?
Edit : When I try to compile I got the following error message "Cannot convert type 'System.Enum' to 'int'"
-
Bill Gregg almost 11 yearsCasting the value as an int should take care of it. Surprised that isn't working.
-
Rémi almost 11 years@DanJ Sorry, it simply doesn't compile with the error message "Cannot convert type 'System.Enum' to 'int'". I will edit the question
-
-
Jakob Borg over 13 yearsNot pretty indeed, I'm pretty surprised this isn't doable in a better way (directly in the configuration), but this looks like a correct answer. :(
-
Jakob Borg over 13 years!!! Don't know how I missed this, but yes!
-
Cosimo almost 11 yearsYes, this is it. Great.
-
Dan J almost 11 yearsSorry, it isn't clear: what isn't working in the code above? Also, could you make the KeyValuePair's key type
FontStyle
instead ofint
? -
Rémi almost 11 yearsThis was it... Just fix typo
FontStylevalue
toFontStyle value
and I will mark as answer as soon as I will be able to do so -
juan almost 11 yearsThis doesn't seem to work for custom headers, strange