How do I support ETags in ASP.NET MVC?

Viewed 26138

How do I support ETags in ASP.NET MVC?

2 Answers

ETAG's in MVC are the same as WebForms or HttpHandlers.

You need a way of creating the ETAG value, the best way I have found is using a File MD5 or ShortGuid.

Since .net accepts a string as a ETAG, you can set it easily using

String etag = GetETagValue(); //e.g. "00amyWGct0y_ze4lIsj2Mw"
Response.Cache.SetETag(etag);

Video from MIX, at the end they use ETAG's with REST

Related