NetTalk Central

NetTalk Web Server => Web Server - Ask For Help => Topic started by: bekeland on May 20, 2009, 02:13:00 PM

Title: Need File Download help
Post by: bekeland on May 20, 2009, 02:13:00 PM
I don't understand this file download problem I am having.  When I use this in a browser:

http://208.109.237.186:88/downloads/caga.gif

It hits my server app and the browser displays the image.  When I use this:

http://208.109.237.186:88/downloads/appnav44full.exe

I get a 400 Bad Request, The requested file was not valid.  The file is there, I just want the browser to come up with the standard Save/Run dialog.  I want this under a button on a form and was trying 'downloads/appnav44full.exe' as the URL and I get the same 400 Bad Request. 

What do I need to do differently to get this file to download to a user?  Thanks.

Brian Ekeland
Title: Re: Need File Download help
Post by: Bruce on May 20, 2009, 10:45:52 PM
Hi Brain,

An early security technique implemented in NetTalk was to suppress requests which contain .., .exe, .pif and so on. Many worms etc try and execute code on the server (something NetTalk is more or less immune to anyway) by executing these sorts of programs.

You can override this check though in the WebHandler.
Go to the ValidateFileName method, and either just RETURN 0 before the parent call, or put in some checks of your own. See the netweb.clw file for what is currently in the method, and either adapt that in the WebHandler or as I say, override it completely.

In PR 39 I've commented out the EXE check because that one is largely obsolete now anyway.

Cheers
Bruce

Title: Re: Need File Download help
Post by: bekeland on May 21, 2009, 07:33:02 AM
Bruce,

Thanks much!  That fixed it up for me.

Brian