How to get Odata Response without Etag using Microsoft.AspNet.OData RRS feed

  • Question

  • User-1243834164 posted

    As per my requirement whenever I am calling ODATA V4 controller get request, from ajax I don't want to get Odata.Etag from response. 

    How can we achieve this. Is there any Web Api Odata server side configuration to disable Etags? 

    "@odata.context": "http://localhost:56274/odata/$metadata#Controller",
    "@odata.count": 1,
    "value": [{
    "@odata.etag": "W/\"YmluYXJ5J0FBQUFBRnFFUUE4PSc=\"",

    Thursday, February 15, 2018 5:20 PM

All replies

  • User283571144 posted

    Hi evurihanumantharao,

    How can we achieve this. Is there any Web Api Odata server side configuration to disable Etags? 

    As far as I know, if don't enable the  [TimeStamp] attribute or the [ConcurrencyCheck]attribute in your data model. 

    It will not add the etag in the response.

    So I suggest you could recheck your model to make sure you don't add the attribute.

    Here I also create an example with etag in odata v4.

    The data model.

        public class Person
            public int Id { get; set; }
             public string Name { get; set; }
            public int Age { get; set; }


    If I remove the "[Timestamp]" or " [ConcurrencyCheck]", it will not generate the etag.

    Best Regards,


    Friday, February 16, 2018 6:44 AM
  • User-1243834164 posted

    Thanks for your response.

    If I change the TimeStamp/ConcurrencyCheck that will impact on my entity framework behavior. I am looking for the option which can work at Odata Level.  I need to eliminate this tag from Odata responses.

    Wednesday, February 21, 2018 7:27 PM
  • User-166373564 posted


    Either use either the [TimeStamp] attribute or the [ConcurrencyCheck] attribute but not both.

    See the "Support for ETags" section in this MSDN blog post. 




    Friday, February 23, 2018 10:01 AM
  • User-1101824297 posted

    For anyone else stumbling across this post, we found that adding an [IgnoreDataMember] attribute to the property solves this (unless you absolutely need the property with the Timestamp attribute in your response)

    Wednesday, May 15, 2019 9:18 PM