문제

I have a WebMethod that recives HTML as parameter somthing like this:

Public Function ConvertHtmlToPdfListAnswer(ByVal dokument As Dokument) As Byte()

In this HTML my path to for example user signature looks like this:

Handlers/SzablonyListImgHandler.ashx?usid=2006

My handler starts like this:

Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest

and it takes parameter from context, creates query for databese and returns stream output like this:

If Not String.IsNullOrEmpty(context.Request.QueryString("usid")) Then
...
...
streamOut.WriteTo(context.Response.OutputStream)

My problem is that it fires onle once...what I mean is that when I call the service again it doesn't enter the handler but it already shows me the image when i check the HTML in debugger view. So when The user changes his signature in database the service method still returns the previous one...I think it could be some kind of chache problem...Any ideas??

도움이 되었습니까?

해결책

yes this is the cache problem, browser caches the result of handler, and when you call the handler again, browser returns the cached result.

to prevent caching you need to set this in the handler before you write stream to context.Response.OutputStream

context.Response.Cache.SetCacheability(HttpCacheability.NoCache);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top