Cancel loading RadChart

Thread is closed for posting
8 posts, 0 answers
  1. Asha
    Asha avatar
    2 posts
    Member since:
    Apr 2011

    Posted 08 Feb 2012 Link to this post

    I'm experiencing an intermittent error when cancelling the loading of a RadChart. During the load of a chart I log out of the application which causes the session to clear. After that I do a redirect to a log in page. Sometimes it works with no problem and sometimes I get an error. It is not consistent and I am testing locally on my development server.

    Here is the error:

    Error loading Radchart image.
      You may also wish to check the ASP.NET Trace for further details.
      Display stack trace? 

    Here are my configurations:

    <!-- this is appsetting for chart image --> 
      <add key="ChartImage_axd" value="storage=session;timeout=20;dir=~\img\chartimage" />

    <system.web>
        <httpHandlers>
          <add path="ChartImage.axd" verb="*" type="Telerik.Web.UI.ChartHttpHandler, Telerik.Web.UI, Version=2011.1.413.40, Culture=neutral, PublicKeyToken=121fae78165ba3d4" validate="false" />
        </httpHandlers>
        <httpRuntime maxRequestLength="2048000" executionTimeout="3600" />
        <sessionState timeout="60"/>

      </system.web>

    <system.webServer>
        <handlers>
          <add name="ChartImage_axd" verb="*" preCondition="integratedMode" path="ChartImage.axd" type="Telerik.Web.UI.ChartHttpHandler" />
        </handlers>
      </system.webServer>

    Do you have any ideas on how I can fix the intermittent error?

    Thank you!

  2. Ves
    Admin
    Ves avatar
    2879 posts

    Posted 10 Feb 2012 Link to this post

    Hi Asha,

    Here is how it works -- RadChart generates an image and places it in the session (this is by default). It also renders an <img> tag with src="ChartImage.axd?..." with certain arguments. When ChartImage.axd is requested the ChartHttpHandler retrieves the image from session. So, if you clear the session before the ChartHttpHandler has managed to retrieve the image you will get this error. A possible solution here would be to set UseSession=false and provide a folder where the chart will store temporarily the images as described here. This way RadChart will not use the session, so you should not experience such issues.

    Best regards,
    Ves
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Asha
    Asha avatar
    2 posts
    Member since:
    Apr 2011

    Posted 23 Feb 2012 Link to this post

    Hi,
    I set UseSession=false and provide a folder where the chart will store temporarily the images as described above. Now I don't get error but I could see my old .png files sitting at that tempfolder. Do I've to code to delete those at end of application? if yes then how can I do that?
  5. Ves
    Admin
    Ves avatar
    2879 posts

    Posted 27 Feb 2012 Link to this post

    Hi Asha,

    ChartHttpHandler is supposed to delete the image files, however if this is not possible (e.g. file is locked) they will remain in the folder. Here is sample code, which you can add to Application_End event handler to delete them:

    string[] files = Directory.GetFiles(MyTempImagesFolder);
    foreach (string file in files)
       File.Delete(file);


    Best regards,
    Ves
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  6. RamaKrishna P
    RamaKrishna P avatar
    7 posts
    Member since:
    Jun 2010

    Posted 11 Dec 2012 Link to this post

    my old .png files sitting at that TempImg folder
    still it is not working .........

    Sub Application_End(ByVal sender As Object, ByVal e As EventArgs)
            ' Code that runs on application shutdown
            Dim files As String() = Directory.GetFiles("TempImg", "*.png")
            For Each file As String In files
                System.IO.File.Delete(file)
            Next
        End Sub

    And

    we are using Ajax Rad Chart for for live application i mean my chart will refresh for every second.it is working fine in IE browser and it is getting slow in Google Chrome
  7. Ves
    Admin
    Ves avatar
    2879 posts

    Posted 13 Dec 2012 Link to this post

    Hello,

    This code will be executed only on application end. If you need to clear the files more often, you may need to develop a separate application to delete the files in this folder.

    Best regards,
    Ves
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  8. RamaKrishna P
    RamaKrishna P avatar
    7 posts
    Member since:
    Jun 2010

    Posted 22 Jan 2013 Link to this post

     i added httphandlers and web server handlers in web.confg file and usesession=false,TempImagesFolder ="TempImg" for rad chart control for my live data application, RadChart1.HttpHandlerUrl = ResolveUrl("ChartImage.axd") in codebehind. but still it is showing ERROR LOADING RADCHART IMAGE?.can u plz tell  me the posible solution.
  9. Ves
    Admin
    Ves avatar
    2879 posts

    Posted 25 Jan 2013 Link to this post

    Hi,

    Can you please show us the related parts of the web.config file?  In addition -- HttpHandlerUrl  property needs to be set in case you use url rewriter. Do you use one?

    Best regards,
    Ves
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017