views:

363

answers:

3

We are currently using random query-strings to prevent Internet Explorer from caching HTML on postbacks, but we are in the process of implementing URL re-writing and it would be nice if we could remove these random parameters.

What's the best pratice in this situation?

+5  A: 

Have you tried the no-cache and expires meta-tags?

Other than that, random generated query-strings are the way to go. In my opinion, its not not that big of a deal. domain.com/stories/man-walks-on-moon/s34b is not exactly making my eyes bleed. And you will still achieve great indexing as far as search engines go.

roosteronacid
I'd vote another +1 for the nick! ROFLMAO!
No Refunds No Returns
Microsoft's own knowledge base article on the subject: http://support.microsoft.com/kb/234067
Zoran Regvart
Would no-cache prevent only HTML content cache or would it prevent any kind of cache including javascript and CSS?
Ciwee
@Andre No, it would only apply to the HTML itself. You'd need your server to send no-cache and expires headers for CSS/JS files.
ceejayoz
I do not agree with the "greating indexing" as for search engines
Ciwee
@André Pena: And your argument for your statement is..? ;)
roosteronacid
A: 

If you have Internet Explorer 8 or the Developer Tools plugin installed, you can select "Always Refresh from Server" from the "Cache" menu on the plugin window (press 'F12' to show it).

TimGThomas
Obviously it should work for all users, not only the developer.
Georg
Not sure how I could have known that since it was never mentioned in the original question.
TimGThomas
+2  A: 

The proper way to control caching is to use proper caching headers. http://www.fiddler2.com/redir/?id=httpperf describes this at length.

Using random query-strings is a simple hack to deal with cases where you don't control the server's headers.

EricLaw -MSFT-
Also, keep in mind that for actual "postbacks", IE isn't typically going to ever get a cache hit for those, since current versions of IE always send No-Cache requests when performing POSTs.
EricLaw -MSFT-