Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • drummerboy46 27 posts 89 karma points
    Sep 06, 2024 @ 08:07
    drummerboy46
    0

    oEmbed providers blocked by ISP

    I have a small problem with my ISP in that it blocks access to oEmbed providers presumably to prevent account spamming with high bandwidth media.

    They do provide the ability to proxy oEmbed addresses with a http proxy server address.

    I have no experience of how to implement a proxy in .net core or how to make a custom oEmbed provider work with a proxy.

    The code they've offered is not overly helpful, it's old .net c# but I believe this API has been translated directly over to .net core....

    try { WebRequest wrq = WebRequest.Create("http://domain.tld"); // replace domain.tld as wanted wrq.Proxy = new WebProxy("http://theproxyaddress"); WebResponse wrp = wrq.GetResponse();

    StreamReader sr = new StreamReader(wrp.GetResponseStream(), Encoding.ASCII); while (sr.Peek() > 0) { Response.Write(sr.ReadLine()); } } catch(WebException ex) { Response.Write(ex.Message); }

Please Sign in or register to post replies

Write your reply to:

Draft