473,563 Members | 2,732 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

vPath cutting off path location name?

Hello. We have a SearchResults.a sp 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("q uery")

Const SEARCH_CATALOG = "web" 'remember to change this

Set oQuery = Server.CreateOb ject("IXSSO.Que ry")
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.MaxRecor ds = 200
oQuery.SortBy = "rank[d]"
oQuery.Columns = "DocAuthor, vpath, doctitle, FileName, Path, Write, Size,
Rank, Create, Characterizatio n, DocCategory"
Set rs = oQuery.CreateRe cordSet("nonseq uential")

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 3519
zz12 wrote on Wed, 13 Jun 2007 16:41:08 -0700:
Hello. We have a SearchResults.a sp 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("q uery")

Const SEARCH_CATALOG = "web" 'remember to change this

Set oQuery = Server.CreateOb ject("IXSSO.Que ry")
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.MaxRecor ds = 200
oQuery.SortBy = "rank[d]"
oQuery.Columns = "DocAuthor, vpath, doctitle, FileName, Path, Write, Size,
Rank, Create, Characterizatio n, DocCategory"
Set rs = oQuery.CreateRe cordSet("nonseq uential")

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.HTMLEnco de function
call)

Response.write "<a href=""" & Server.URLEncod e(rs("vpath")) & """<font
color='#49698D'
size='2' style='arial'>< b>" & Server.HTMLEnco de(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.URLEncod e 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****@worldof spack.comwrote in message
news:OT******** ******@TK2MSFTN GP03.phx.gbl...
zz12 wrote on Wed, 13 Jun 2007 16:41:08 -0700:
>Hello. We have a SearchResults.a sp 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

sSearchStrin g = Request.Form("q uery")

Const SEARCH_CATALOG = "web" 'remember to change this

Set oQuery = Server.CreateOb ject("IXSSO.Que ry")
oQuery.Catal og = 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.MaxReco rds = 200
oQuery.SortB y = "rank[d]"
oQuery.Colum ns = "DocAuthor, vpath, doctitle, FileName, Path, Write,
Size,
Rank, Create, Characterizatio n, DocCategory"
Set rs = oQuery.CreateRe cordSet("nonseq uential")

Response.wri te "<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.HTMLEnco de function call)

Response.write "<a href=""" & Server.URLEncod e(rs("vpath")) & """<font
color='#49698D'
size='2' style='arial'>< b>" & Server.HTMLEnco de(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.URLEncod e 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
4041
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 Python standard library, and Reinhold Birkenfeld started a discussion on it in python-dev...
5
11024
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 created in the wrong folder on the hard drive. Before I discovered these files, .NET kept trying to create a new project with _1 following the project...
2
5346
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 code below in the Web.Config file defines the authentication as forms and the aspx file required for login if the user is unauthenticated... this...
3
1530
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 users="" /> section of a <location> in web.config, or do i have to add these users as key-value elements that can be accessed by AppSetting... ? i...
4
14286
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 WORK!! Am i missing something ?? <location path="/Forums/CORP"> <system.web>
2
10407
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 question but relationated, Is posible don´t put a path to the picture in the image control (in desing) ? The Database will be move frecuntly and it...
34
3927
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 environment variable. Every time, I've had to go through and add this by hand, to have something resembling a usable Python installation. No such...
7
2940
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 need the flexibility of being able to move the BE data to wherever I want, without manually going through this process. I just want to change the...
15
3938
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 on refresh. I know you could use cookies but I also want to give it a unique identifier so that if i put it in my topic header templet, its unique...
0
7664
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8106
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7638
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7948
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6250
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5484
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3642
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2082
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.