473,386 Members | 1,997 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

vPath cutting off path location name?

Hello. We have a SearchResults.asp page that returns a list of asp pages
that are associated with the user's search parameters that they type in in a
search page called something like Search.asp. We noticed that the last line
in the following rs("vpath") value lists the path up until the first blank
of either a folder or file name and cuts off the rest of the path's text
name. Does anyone know how to have the vpath list the entire path name even
including spaces if there are any?

<%
Dim sSearchString
Dim oQuery

sSearchString = Request.Form("query")

Const SEARCH_CATALOG = "web" 'remember to change this

Set oQuery = Server.CreateObject("IXSSO.Query")
oQuery.Catalog = SEARCH_CATALOG
oQuery.Query = "@all " & sSearchString & " AND NOT #path *_* AND NOT #path
*downloads* AND NOT #path *images* AND NOT #filename *.class AND NOT
#filename *.asa AND NOT #filename *.css AND NOT #filename *postinfo.html"
oQuery.MaxRecords = 200
oQuery.SortBy = "rank[d]"
oQuery.Columns = "DocAuthor, vpath, doctitle, FileName, Path, Write, Size,
Rank, Create, Characterization, DocCategory"
Set rs = oQuery.CreateRecordSet("nonsequential")

Response.write "<a href=" & rs("vpath") & "<font color='#49698D' size='2'
style='arial'><b>" & rs("doctitle") & "</b></font></a><br>"
%>

Thanks in advance.
Jun 13 '07 #1
2 3509
zz12 wrote on Wed, 13 Jun 2007 16:41:08 -0700:
Hello. We have a SearchResults.asp page that returns a list of asp pages
that are associated with the user's search parameters that they type in in
a search page called something like Search.asp. We noticed that the last
line in the following rs("vpath") value lists the path up until the first
blank of either a folder or file name and cuts off the rest of the path's
text name. Does anyone know how to have the vpath list the entire path
name even including spaces if there are any?

<%
Dim sSearchString
Dim oQuery

sSearchString = Request.Form("query")

Const SEARCH_CATALOG = "web" 'remember to change this

Set oQuery = Server.CreateObject("IXSSO.Query")
oQuery.Catalog = SEARCH_CATALOG
oQuery.Query = "@all " & sSearchString & " AND NOT #path *_* AND NOT #path
*downloads* AND NOT #path *images* AND NOT #filename *.class AND NOT
#filename *.asa AND NOT #filename *.css AND NOT #filename *postinfo.html"
oQuery.MaxRecords = 200
oQuery.SortBy = "rank[d]"
oQuery.Columns = "DocAuthor, vpath, doctitle, FileName, Path, Write, Size,
Rank, Create, Characterization, DocCategory"
Set rs = oQuery.CreateRecordSet("nonsequential")

Response.write "<a href=" & rs("vpath") & "<font color='#49698D'
size='2' style='arial'><b>" & rs("doctitle") & "</b></font></a><br>"
%>
You need to put quotes around the path, and I'd recommend URL encoding them
too. For completeness I'd also recommend HTML encoding doctitle just in case
there are any characters that might cause problems (however, if you know
this is already in HTML format you can remove the Server.HTMLEncode function
call)

Response.write "<a href=""" & Server.URLEncode(rs("vpath")) & """<font
color='#49698D'
size='2' style='arial'><b>" & Server.HTMLEncode(rs("doctitle")) &
"</b></font></a><br>"

Notice the "" before and after the path value, this writes a " at those
positions

That should do it. The reason the path was being cut at the space is because
without the href value being quote the browser has to use spaces as the
attribute delimiters, eg.

<a href=my path>

the href value becomes "my", because "path" could be another attribute name.
If you had

<a href="my path">

then the browser will know that "my path" is the entire path. However,
spaces in URLs are not allowed, so you do this:

<a href="my+path">

and everthing works properly. Server.URLEncode will do all the work of
ensuring that the vpath value is correctly presented for URL use, replacing
all non-legal chars with URL entities.

Dan
Jun 14 '07 #2
That fixed it. You are awesome. Thanks a bunch Daniel. Much appreciated.

Take cares :)
"Daniel Crichton" <ms****@worldofspack.comwrote in message
news:OT**************@TK2MSFTNGP03.phx.gbl...
zz12 wrote on Wed, 13 Jun 2007 16:41:08 -0700:
>Hello. We have a SearchResults.asp page that returns a list of asp pages
that are associated with the user's search parameters that they type in
in
a search page called something like Search.asp. We noticed that the last
line in the following rs("vpath") value lists the path up until the first
blank of either a folder or file name and cuts off the rest of the path's
text name. Does anyone know how to have the vpath list the entire path
name even including spaces if there are any?

<%
Dim sSearchString
Dim oQuery

sSearchString = Request.Form("query")

Const SEARCH_CATALOG = "web" 'remember to change this

Set oQuery = Server.CreateObject("IXSSO.Query")
oQuery.Catalog = SEARCH_CATALOG
oQuery.Query = "@all " & sSearchString & " AND NOT #path *_* AND NOT
#path
*downloads* AND NOT #path *images* AND NOT #filename *.class AND NOT
#filename *.asa AND NOT #filename *.css AND NOT #filename *postinfo.html"
oQuery.MaxRecords = 200
oQuery.SortBy = "rank[d]"
oQuery.Columns = "DocAuthor, vpath, doctitle, FileName, Path, Write,
Size,
Rank, Create, Characterization, DocCategory"
Set rs = oQuery.CreateRecordSet("nonsequential")

Response.write "<a href=" & rs("vpath") & "<font color='#49698D'
size='2' style='arial'><b>" & rs("doctitle") & "</b></font></a><br>"
%>

You need to put quotes around the path, and I'd recommend URL encoding
them too. For completeness I'd also recommend HTML encoding doctitle just
in case there are any characters that might cause problems (however, if
you know this is already in HTML format you can remove the
Server.HTMLEncode function call)

Response.write "<a href=""" & Server.URLEncode(rs("vpath")) & """<font
color='#49698D'
size='2' style='arial'><b>" & Server.HTMLEncode(rs("doctitle")) &
"</b></font></a><br>"

Notice the "" before and after the path value, this writes a " at those
positions

That should do it. The reason the path was being cut at the space is
because without the href value being quote the browser has to use spaces
as the attribute delimiters, eg.

<a href=my path>

the href value becomes "my", because "path" could be another attribute
name. If you had

<a href="my path">

then the browser will know that "my path" is the entire path. However,
spaces in URLs are not allowed, so you do this:

<a href="my+path">

and everthing works properly. Server.URLEncode will do all the work of
ensuring that the vpath value is correctly presented for URL use,
replacing all non-legal chars with URL entities.

Dan

Jun 14 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

70
by: Michael Hoffman | last post by:
Many of you are familiar with Jason Orendorff's path module <http://www.jorendorff.com/articles/python/path/>, which is frequently recommended here on c.l.p. I submitted an RFE to add it to the...
5
by: David Webb | last post by:
The problem started when the Working Folder for a project was somehow set to the folder of another project. I set the correct working folder in VSS and deleted the .vbproj files that had been...
2
by: Murphy | last post by:
Our website contains subdirectories for each subsidiary company, each company has it's own look and feel to the pages in their subdirectory although they are all part of the main website. The...
3
by: Dan | last post by:
hi ng, i'd like to add control elements on a page, but only for users that are authotized to access a certain location, defined in web.config. my question: is it possible to read the <allow...
4
by: Patrick Olurotimi Ige | last post by:
I have a Virtual directory FORUMS and the a folder CORP under that Directory. And i want to add a location path to this folder in web.config but after trying the below code it doesn't seem to...
2
by: Ruymán | last post by:
Hello!, is possible use relative path in access? for example use "photo\image1.jpg" instead of "c:\db\photo\image1.jpg", I try it but I cann't, but in Visual Basic if is possible. Other...
34
by: Ben Sizer | last post by:
I've installed several different versions of Python across several different versions of MS Windows, and not a single time was the Python directory or the Scripts subdirectory added to the PATH...
7
by: ApexData | last post by:
Hello I currently Link the FE/BE using the LinkTables Option and the Linked Table Manager. Any time I need to move the BE to another location, I have to go through this process over again. I...
15
by: Inny | last post by:
Hello, I found this simple js star rating script that I want to modify slightly. firstly I want to retain current vote , say 3 stars, untill its changed again. right now it resets to unvoted...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.