ASP - Doesn't accept spaces in file path

Posted on 2011-10-10
Last Modified: 2012-05-12
Thank you for looking at my question,

I am trying to build an intranet page that shows links to pdf files on a company's server.

The documents are resident in sub-drectory of a shared folder "Company Shared Folders/..."

The virtual directory name I have used on the web server has no spaces in it's name.

The code I am using is as follows:

Connection string

where = request("server_name")
strconn1 = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" & server.mappath("dbase/documentation.mdb") & ";"

Query string

                  Set con = Server.CreateObject("ADODB.Connection")
                  con.Open strconn1, "", ""

                  strSQL = "SELECT * FROM tblDocumentation WHERE intCatSubNumber = " & id

                  Set rst = Server.CreateObject("ADODB.Recordset")
                  rst.Open strSQL, con, adOpenStatic, adLockReadOnly, adCmdText

                  If Not rst.EOF Then

                        Response.write("<table border=""5"" cellspacing=""0"" width=""600"" cellpadding=""0"" bordercolor=""Red"">" & vbCrLf)
                        Do While Not rst.EOF
                              Response.write("<tr>" & vbCrLf)

                              Response.write("<td align=""center""><p class=""menulink""><font size=""2""><a href=""default2.asp?id=" & rst("txtDocumentPath") & """>" & rst("txtDocumentName") & "</a></font></td>" & vbCrLf)
                              'Response.write("<td align=""center""><p class=""menulink""><font size=""2""><a href="" & rst("txtDocumentPath") & """>" & rst("txtDocumentName") & "</a></font></td>" & vbCrLf)
                              Response.write("</tr>" & vbCrLf)
                        Response.write("<tr>" & vbCrLf & "<td colspan=""2""><img border=""0"" src=""pad.gif"" width=""2"" height=""2""></td>" & vbCrLf & "</tr>" & vbCrLf & "</table>" & vbCrLf)

How do I get the system to handle the spaces in the path?

Question by:Crxfrd
    1 Comment
    LVL 25

    Accepted Solution

    Try URL encoding the document path:

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Join & Write a Comment

    I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
    I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    732 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    23 Experts available now in Live!

    Get 1:1 Help Now