What I am trying to do is generate a URL for downloading a document. However when the script gets the name of the file I type into the form if the filename begins with one of the following: 01- or 02- or 03- or 04- or 05- or 06- or 07- the URL comes out as: http://888.888.888.888/activenet/download.asp?CMD=GO&DocName=04-05 66.doc&DocPath=D2ActiveNETCHECKOUT-05 66.doc Note the square beside checkout in the URL it should come out as CHECKOUT\04-05 66.doc on the end but whenever the filename starts with lets say 03- it adds the wierd square character. If the filename begins with anything else other then the ones mentioned above even 08- it works fine. I blocked out the IP address with 8's The asp page is being hosted on Windows 2003 server and IIS 6.0. Any help would be appreciated. Below is the code option explicit dim strFileName, strFilePath, strCMD, Tmp strFileName = Request.Querystring("DocName") Tmp = server.MapPath(strFileName) Tmp = left(tmp,len(tmp)-len(strFileName)) & "CHECKOUT\" strFilePath = Tmp & strFileName strCMD = UCase(Request.QueryString("CMD")) if strCmd="GO" then Response.Redirect "startDownload.asp?DocName=" & strFileName & "&DocPath=" & strFilePath end if
it has been a while but isnt \ an illegal character for a url? You would either need to construct it as a string first and then urlencode it or alternatively given it is your own site, why are you doing the mappath etc in this page and passing it to the download one? why not just pass it the doc name and allow it to do the locating?
Thanks Asta for the quick reply, I don't know much about .asp programming, this is a vendor supplied app and they are blaming the square on an issue with the server or iis which is my responsibility. I questioned them on this because if I turn the slash the other way even / it works but then puts underscores in places of spaces. In short I was hoping to avoid getting a new server going from scratch, installing their app and proving to them its not a problem with the server. I've tried doing server.urlencode(strfilepath) after the line strFilePath = Tmp & strFileName but the square keeps appearing still.
I just put up a test page with your code on my local machine to test, and I did not find any problems, the path got transalated without that special character. Wondering what the problem could be.