Last post Apr 04, 2016 02:25 AM by mengju
Mar 10, 2016 05:49 AM|vijay gite|LINK
I have created User Control which uses ChartControl & creates Graph for me. My web.config configurations for ChartImage Handler are :
<add key="ChartImageHandler" value="storage=memory;timeout=20;" />
i.e I am not stroring these images anywhere on my server.
ChartEmbedControl embedControl = page.LoadControl("~/UserControls/ChartEmbedControl.ascx") as ChartEmbedControl;
//Then i bind all its required data
After this i converted this user control into html string & send back as an response to client.
StringBuilder sb = new StringBuilder();
StringWriter sw = new StringWriter(sb);
HtmlTextWriter writer = new HtmlTextWriter(sw);
When i make AJAX call for graph from same website page then all graph images are shown correctly on each browser. BUT when i make this AJAX call from CROSS DOMAIN PAGE then that graph image is not shown in chorme & firefox but its working fine IE. I have
added this header as well -Access-Control-Allow-Origin . But still image is not shown.
Mar 11, 2016 09:36 AM|Klein Zhang|LINK
According to your description, it seems cross domain cause the issue. As you said, you could put the following code into the serve response header which could solve the issue. As you have added these settings for response header in your project, I
suppose that the use method of setting is not right. You could refer to the follow sample to check your settings about cross domain.
// allowing any origin to access the resource.
// Specifies the method or methods allowed when accessing the resource.
Access-Control-Allow-Methods: POST, GET, OPTIONS
// Used in response to a preflight request to indicate which HTTP headers can be used when making the actual request
// This header indicates how long the results of a preflight request can be cached.
For more information, please refer to:
Enabling Cross-Origin Requests in asp.net
Mar 11, 2016 10:47 AM|vijay gite|LINK
I have already added Access-Control-Allow-Origin: * This header into server response. I will explain you my problem in deep.
Server response for cross domain request contains some html string & ChartImg Control which has Image created in memory (i.e Image is created in memory & is not saved on disk). Some part of response like HTML string is displayed on page but Image which comes
as response is not shown in Chrome & Firefox whereas it is visible in IE . HTTP handler handles request coming for this image. example path of this image is:
IE found this image & is visible in browser but in chrome Image not found error is given.
Hope you will understand my problem!
Apr 04, 2016 02:25 AM|mengju|LINK
Please use F12 to check some more detailed information. check if it has a image source. typinge image source URL on your browser check if it shows on your browser.