Google Charts for SSL

I need Googleโ€™s free graphics to work on SSL without any security issues. I am using C # and asp.net.

Since Google charts do not support SSL by default, I am looking for a reliable method for using charts, but my user does not receive any security warnings in their browser.

One thought was to use a handler to call api diagrams and then generate the output needed for my site.

Like Pants are optional on a blog. I could not get this example to work at this stage.

Any suggestions or samples are welcome.

thanks

+4
source share
3 answers

We do this automatically on the NetQuarry platform - it's quite simple, although you force the image to enter through your site against charts.google.com, causing your browser to run the request through a single connection.

Since the chart is just a link to the image, we do to build a link to the chart (a much more complicated process, obviously), and then add the entire link to the query string on the internal handler (.ashx? Req = chart & handler). So, the new link looks like this:

?

handler.ashx act = CHRT & REQ = chart & CHT = p3 & candidate of historical sciences = 450x170 & CHD = s: HAR9GBA & CHL = New | In% 20Progress | Answered | Wouldn't% 20Respond | At% 20Hold | Future | Review | & Chg = 20,20,1,5 & Chg = 10,25,1,5 & CHCO = 0A477D

Then we simply upload the image data and record it as an answer.

Here is the code:

Blockquote

private void GoogleChart(HttpContext cxt) { const string csPrefix = "?act=chrt&req=chart&"; HttpRequest req = cxt.Request; HttpResponse rsp = cxt.Response; string sUrl = cxt.Request.RawUrl; int nStart = sUrl.IndexOf(csPrefix, StringComparison.OrdinalIgnoreCase); rsp.Clear(); if (nStart > 0) { sUrl = "http://chart.apis.google.com/chart?" + sUrl.Substring(nStart + csPrefix.Length); System.Net.WebClient wc = new System.Net.WebClient(); byte[] buffer = wc.DownloadData(sUrl); cxt.Response.ClearContent(); cxt.Response.ClearHeaders(); cxt.Response.ContentType = "application/octet-stream"; cxt.Response.AppendHeader("content-length", buffer.Length.ToString()); cxt.Response.BinaryWrite(buffer); } } 
+3
source

The Google Charts API is now available via HTTPS through https on chart.googleapis.com.

Source: http://www.imperialviolet.org/2010/11/29/charthttps.html

+10
source

I have a partial solution that has one problem.

here is a link to my new post asking for help with a specific problem related to my solution.

My SSL Handler Attempt

0
source

Source: https://habr.com/ru/post/1306132/


All Articles