0

While invoking same MVC controller action method successively with different inputs noticed in the server logs during the second call still holding the input parameter values that were passed during the first call.

Below is the calling procedure in angular

 var oDat = {
   dob: '',
   tob: '',
   latlng: '',
   timezone: ''
   };
   oDat.dob = dob.split('T')[0].split('-')[2] + '|' + dob.split('T')[0].split('-')[1] + '|' + dob.split('T')[0].split('-')[0];
   oDat.tob = dob.split('T')[1].split(':')[0]  + '|' + dob.split('T')[1].split(':')[1] + '|' + '0';
   oDat.latlng = latlng;
   oDat.timezone = tz;
   //let headers = new Headers({ 'Content-Type': 'application/json; charset=utf-8' });
    let headers = new HttpHeaders();
    headers = headers.set('Content-Type', 'application/json; charset=utf-8');   
    return this.http.post(this.apiUrl9, JSON.stringify(oDat), {headers: headers}).pipe(
    map(this.extractData),
    catchError(this.handleError)
   );

UPDATE The issue remained same even after disable http cache

headers.append('Cache-control', 'no-cache');
    headers.append('Cache-control', 'no-store');
    headers.append('Expires', '0');
    headers.append('Pragma', 'no-cache');
Naga
  • 2,368
  • 3
  • 23
  • 33

1 Answers1

0

I resolved the server cache issue by setting below attribute right above the action method

[OutputCache(NoStore = true, Duration = 0)]

here is the link that helped Prevent Caching in ASP.NET MVC for specific actions using an attribute

Naga
  • 2,368
  • 3
  • 23
  • 33