Pregunta

I have been setting up a mvc project with a webapi. I have it working but I do not know why my GET calls have additional pieces to their URL's.

Example:

/api/User/Zholen?_=1373490280823

Can someone explain to me what this number at the end is for? It seems to only be attached to GET calls and only the ones I personally call via javascript.

I am using amplify.js when making these calls from javascript. I noticed that the number increments per call ***23, 24, 25 etc.

I do also send a cookie with each call which stores information about the current logged on user.

I am not sure which, if any, of these things are causing this number to be generated.

¿Fue útil?

Solución

jQuery adds this to AJAX URLs to prevent caching.

To prevent this, pass cache: true as an option.

Otros consejos

GET calls are cached by client browsers. I guess that this random number is appended by the javascript framework you are using to bust the cache and ensure that the call will always hit the web server.

For example if you send successive GET calls to the exact same URL, the browser might have cached the results of previous calls and never perform the request and return cached values.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top