Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8073405
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T14:19:58+00:00 2026-06-05T14:19:58+00:00

Before while my web application was on-premise solution I used standard asp.net chart control

  • 0

Before while my web application was “on-premise” solution I used “standard” asp.net chart control with disk storage mode. Like this :

<asp:Chart ID="AssetDistChart" runat="server" BackColor="Transparent" 
    Width="250px" Height="350px" ImageStorageMode="UseImageLocation" ImageLocation="~/files/categories_#SEQ(30,20)"> ...

With this all my chart’s pictures are generated with name categories_XXX in folder /files… And that worked perfect.

Now, I need to transfer my solution to Azure platform and storing chart images on disk is not option for me anymore. So I created my own chart handler which saves/loads chart images from Blob storage. Handler is below :

public class ChartImageHandler : IChartStorageHandler
    {
        ...

        public void Delete(string key)
        {
            CloudBlob csv = chartContainer.GetBlobReference(key);
            csv.Delete();
        }

        public bool Exists(string key)
        {
            bool exists = true;
            WebClient webClient = new WebClient();
            try
            {
                using (Stream stream = webClient.OpenRead(key))
                { }
            }
            catch (WebException)
            {
                exists = false;
            }
            return exists;
        }

        public byte[] Load(string key)
        {
            CloudBlob image = chartContainer.GetBlobReference(key);
            byte[] imageArray;
            try
            {
                imageArray = image.DownloadByteArray();
            }
            catch (Exception e)
            {
                System.Threading.Thread.Sleep(1000);
                imageArray = image.DownloadByteArray();

            }
            return imageArray;
        }

        public void Save(string key, byte[] data)
        {
            CloudBlockBlob pictureBlob = chartContainer.GetBlockBlobReference(key);
            pictureBlob.UploadByteArray(data);
        }
    }

Also, my asp.net chart control is now like this :

<asp:Chart ID="AssetDistChart" runat="server" BackColor="Transparent" 
    Width="250px" Height="350px" ImageStorageMode="UseHttpHandler">

And also I edited chart settings in web.config to use this new handler.

This handler works but my pictures are saved with generic name :

chart_0.png
chart_1.png
…

How can I manage my own names of files like before. I try to add ImageLocation="~/files/categories_#SEQ(30,20)"

to asp.net chart control but without success. How can I set my own name(keys) and where to place that? In handler, asp.net chart control or in codebehind file where char control is declared.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T14:20:00+00:00Added an answer on June 5, 2026 at 2:20 pm

    In above code, when you store your image in Azure Blob storage you are directly storing it inside a container so you when access them you retrieve as

    http://azure_storage_name.*/_containername_/chartimage_name
    

    Alternatively you can create a folder type chart image name such as files/categories_1 and files/categories_2 etc, which will be stored in Azure Blob store as:

    http://azure_storage_name.*/_containername_/files/categories_1
    http://azure_storage_name.*/_containername_/files/categories_2
    

    To get it, you just need to change your code while you are saving it in your Save() function:

    string key = "files/myimage_1.jpg";
    CloudBlockBlob pictureBlob = container.GetBlockBlobReference(key);
    

    So when you image will save it will be saved as in your azure storage /container_name/files/myimage_1.jpg which you can verify by accessing the Windows Azure Storage.

    Now when you read it just read the key and you will get file name as you expected. You may need to massage your code to get the way you want, but I have given you an idea how to do it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using the ASP.Net Login control to login a web application. When the user
I have an existing ASP.net 3.5 web application. This is tested and working in
We found a problem while accessing the Web service from our ASP.Net MVC project
In my ASP.NET MVC 2 web application, I allow users to create custom input
We have a huge ASP.NET web application which needs to be deployed to LIVE
does someone know how to update an assembly on a live ASP.NET web application
in a asp.net web application, I am using AJAX to submit a form. I
While integrating a Django app I have not used before, I found two different
I have a web application on a site that takes a while (~10 seconds)
Senerio We have a C# .Net Web Application that records incidents. An external database

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.