Board index » delphi » problem copying a file off a website using TNMHttp Component

problem copying a file off a website using TNMHttp Component

i have been using this component to copy a file off of a website to a local
drive. it worked fine while testing it from within our own network, however,
it doesnt work when used from a certain outside network. since my networking
knowledge is limited, i hope that somebody out there can help me with this
problem.

the code i use is as follows:

function TfrmInternetUpdate.getFileFromInternet(

URLSource, Destination : string): boolean;

var

UseProxy, ProxyIP, ProxPort : string;

begin // GetFileFromInternet

try

if not RequireProxySettings then

GetProxySettings(UseProxy, ProxyIP, ProxPort)

else

WriteProxySettings;

with nmHttp1 do // a TNMHttp component i pasted on the form in design time

begin // with nmHttp1

InputFileMode := TRUE;

if UseProxy = 'Y' then

begin

Proxy := ProxyIP;

ProxyPort := StrToInt(ProxPort);

end;

// set path and name for retrieved file

Body := Destination;

Get(URLSource);

Disconnect;

end; // with nmHttp1

Result := True;

except

Result := False;

end; // try except

end; // GetFileFromInternet

as i said, it works great when retrieving a file from within our own
network. even when i use our proxy server settings - it works great, and i
can tell that it does in fact use the proxy server due to the lightning
spead at which it downloads if it has already downloaded that particular
file before.

when using the code in an app running at a certain client, who is on an
outside LAN, it does not work. the 'DESTINATION' file which was supposedly
copied from the website simply has the following text in it:

"Error: Access is Denied."

just to give you more info about this client's setup: they use a firewall
(like us) as well as a proxy server. i have entered their proxy settings
correctly, but it still doesn't work from within the application. when i
enter the same proxy settings into a web browser (eg Internet Explorer), and
enter the 'URLSource' there, it does in fact ask to copy the file to disk,
proving that the proxy server is allowing access to the particular
website.(the LAN administrator for their network has opened access to our
website - which is where the file to download is situated)

i hope that someone can help me with this.

you can mail me directly at:

n...@meridian.co.za

thanks

 

Re:problem copying a file off a website using TNMHttp Component


i have been using this component to copy a file off of a website to a local
drive. it worked fine while testing it from within our own network, however,
it doesnt work when used from a certain outside network. since my networking
knowledge is limited, i hope that somebody out there can help me with this
problem.

the code i use is as follows:

function TfrmInternetUpdate.getFileFromInternet(
    URLSource, Destination : string): boolean;
var
  UseProxy, ProxyIP, ProxPort : string;
begin // GetFileFromInternet
  try
    if not RequireProxySettings then
      GetProxySettings(UseProxy, ProxyIP, ProxPort)
    else
      WriteProxySettings;
    with nmHttp1 do                       // pasted on form during design
time
    begin // with nmHttp1
      InputFileMode := TRUE;
      if UseProxy = 'Y' then
      begin
        Proxy := ProxyIP;
        ProxyPort := StrToInt(ProxPort);
      end;
      // set path and name for retrieved file
      Body := Destination;
      Get(URLSource);
      Disconnect;
    end; // with nmHttp1
    Result := True;
  except
    Result := False;
  end; // try except
end; // GetFileFromInternet

as i said, it works great when retrieving a file from within our own
network. even when i use our proxy server settings - it works great, and i
can tell that it does in fact use the proxy server due to the lightning
spead at which it downloads if it has already downloaded that particular
file before.

when using the code in an app running at a certain client, who is on an
outside LAN, it does not work. the 'DESTINATION' file which was supposedly
copied from the website simply has the following text in it:

"Error: Access is Denied."

just to give you more info about this client's setup: they use a firewall
(like us) as well as a proxy server. i have entered their proxy settings
correctly, but it still doesn't work from within the application. when i
enter the same proxy settings into a web browser (eg Internet Explorer), and
enter the 'URLSource' there, it does in fact ask to copy the file to disk,
proving that the proxy server is allowing access to the particular
website.(the LAN administrator for their network has opened access to our
website - which is where the file to download is situated)

i hope that someone can help me with this.

you can mail me directly at:

n...@meridian.co.za

thanks

Other Threads