Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/284.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# ASP.NET图表自定义处理程序_C#_Asp.net_Azure_Azure Storage_Asp.net Charts - Fatal编程技术网

C# ASP.NET图表自定义处理程序

C# ASP.NET图表自定义处理程序,c#,asp.net,azure,azure-storage,asp.net-charts,C#,Asp.net,Azure,Azure Storage,Asp.net Charts,以前,当我的web应用程序是“本地”解决方案时,我使用“标准”asp.net图表控件和磁盘存储模式。像这样: <asp:Chart ID="AssetDistChart" runat="server" BackColor="Transparent" Width="250px" Height="350px" ImageStorageMode="UseImageLocation" ImageLocation="~/files/categories_#SEQ(30,20)"> .

以前,当我的web应用程序是“本地”解决方案时,我使用“标准”asp.net图表控件和磁盘存储模式。像这样:

<asp:Chart ID="AssetDistChart" runat="server" BackColor="Transparent" 
    Width="250px" Height="350px" ImageStorageMode="UseImageLocation" ImageLocation="~/files/categories_#SEQ(30,20)"> ...
<asp:Chart ID="AssetDistChart" runat="server" BackColor="Transparent" 
    Width="250px" Height="350px" ImageStorageMode="UseHttpHandler">
另外,我的asp.net图表控件现在是这样的:

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

我还在web.config中编辑了图表设置,以使用这个新的处理程序

此处理程序可以工作,但我的图片以通用名称保存:

图表0.png 图1.png

如何像以前一样管理自己的文件名。我尝试添加
ImageLocation=“~/files/categories_35;SEQ(30,20)”


到asp.net图表控件,但未成功。我如何设置自己的名字(键)以及放置在哪里?在handler、asp.net图表控件或声明了char控件的codebehind文件中。

在上述代码中,当您将图像存储在Azure Blob存储中时,您将直接将其存储在容器中,以便在访问图像时以

http://azure_storage_name.*/_containername_/chartimage_name
或者,您可以创建文件夹类型的图表图像名称,如文件/类别\u 1和文件/类别\u 2等,这些名称将作为以下内容存储在Azure Blob存储中:

http://azure_storage_name.*/_containername_/files/categories_1
http://azure_storage_name.*/_containername_/files/categories_2
要获得它,只需在Save()函数中保存代码时更改代码:

string key = "files/myimage_1.jpg";
CloudBlockBlob pictureBlob = container.GetBlockBlobReference(key);
因此,当您将图像保存时,它将保存为您的azure存储/container\u name/files/myimage\u 1.jpg,您可以通过访问Windows azure存储进行验证


现在,当您读取它时,只需读取密钥,您将获得您期望的文件名。您可能需要按摩您的代码以获得您想要的方式,但我已经为您提供了一个方法

多谢各位。但是我想在asp.net图表控件中定义我自己的图表图像名称,就像内部部署方式一样(使用#SEQ())。。Save()函数已经需要获取“我自己的定义”键,因为我需要在codebehind中为不同的用户(不同的名称)生成键。我没有尝试过,但是您可以先使用#SEQ创建一个此类名称的表,然后选择一个名称作为键传递,这样您就可以得到您想要的。或者您可以使用不同的用户名创建文件夹“filesX”,然后创建文件名“fileX/image”和“fileY/image”。这样你就可以实现你想要的。