Reputation: 534
I have a financial system where I create pdf forms for tax forms, receipts and etc I have a printing page where I open the document for the client in an iframe which suits dynamically the src to the client's pdf -
curUser = usrSrv.getUserFromCookie(cookie);
string formSrc = "UserForms/" + curUser.Id + ".pdf";
ifPdf.Attributes.Add("src", formSrc);
iI my code behind I've inserted the clear cache properties as such:
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetNoStore();
but still - in several cases (when the user goes back from the print page for ex') - the pdf file is being saved in the cache and the system is losing its purpose.
I've figured out there might be a way with - server.Mappath()
- but when I use it - the location seems fine and the file exists but the browser never finds the actual file or simply don't show it.
Upvotes: 0
Views: 551
Reputation: 328
If you add a querystring parameter to the end of the frame's URL you will get the result you need, as long as the parameter is generated fresh and unique every time. A common way of doing that is to add something like a timestamp:
url += "?ts=" + DateTime.Ticks;
or:
url += "?ts=" + Date.getTime();
Upvotes: 1