Firewall blocks the image inserted by Aspose.Words for .NET

for the same url we can able to see the image but from aspose.words the image is not displaying in document how can we confirm whether firewall is blocking aspose.words?

Hi,

It would be great if you please check the firewall log and your system event viewer security log for
this issue. Please check either specific URL is blocked or not in log files.

Please share the exact URL which you are using in IMG tag. We are investigating this issue in more depth and will share our findings with you asap.

Hi,

Please execute the following code snippet at your side in a standalone application and share your findings with us.

WebRequest request = WebRequest.Create(href);
WebResponse response = request.GetResponse();
using (Stream responseStream = response.GetResponseStream())
using (FileStream fileStream = File.OpenWrite("C:\\Image.jpg"))
{
    byte[] buf = new byte[4096];
    while (true)
    {
        int bytesRead = responseStream.Read(buf, 0, buf.Length);
        if (bytesRead <= 0)
            break;
        else
            fileStream.Write(buf, 0, bytesRead);
    }
}

const string href = “here i gave remote image path url”

WebRequest request = WebRequest.Create(href);
WebResponse response = request.GetResponse(); //--**iam getting error at this line given below**

The server committed a protocol violation. Section=ResponseHeader Detail=CR must be followed by LF

i want by using documentbuilder.inserthtml …how to do ?

Hi,

Thanks for sharing the information. The error you facing is not related to Aspose.Words. It seems that you can not access image URL over network. Please check your network setting, firewall etc.

In my local system windows firewalls is not installed and iam not able to see tht windows firewalls in controlpanel-security centre…in tht case y iam not able to accesss tht remote image url in Aspose.words code and y it is getting cross mark in word document…

where as in remote servers(Dev servers) windows firewall is in off mode…even though

iam not able to accesss tht remote image url in Aspose.words code and y it is getting cross mark in word document…

Hi,

Please accept my apologies for your inconvenience.

We have tested this scenario at different operating system and have not found this issue. May be we are missing some thing.

I checked this scenario over local network, one computer serve as server and other is client. The image is located at server. e.g http://serverIP/image.jpg (server IP is local network IP). Please confirm, am I using the same network which you are using?

Please share the exact URL which you are using in IMG tag.

We really appreciate your patience.

My Remote Server Image url Syntax looks as:
http://IPAddress:PortNumber/SelectImage.aspx?ImageID=8
or
http://WebsiteName:PortNumber/SelectImage.aspx?ImageID=8

Hi,

Thanks for sharing the information. Are you accessing the image over local network?

I checked this scenario over local network,
one computer serve as server and other is client. The image is located
at server. e.g http://serverIP/image.jpg (server IP is local network IP). Please confirm, am I using the same network which you are using?

Iam accessing tht image if i pasted tht image url in browser or if i hit tht url in browser in local network…Problem is iam not able to see same image url in word document from aspose.words code in local network…iam getting cross mark in final word document…

iam able to see image in word document by keeping this line of code in config file of website on server…

<configuration>
    <system.net>
        <settings>
            <httpWebRequest useUnsafeHeaderParsing="true" />
        </settings>
    </system.net>
</configuration>

Hi,

It is really very nice to hear from you that your problem has been solved. Please let us know if you have any more queries. We are always glad to help you.