Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > vPath cutting off path location name?

Reply
Thread Tools

vPath cutting off path location name?

 
 
zz12
Guest
Posts: n/a
 
      06-13-2007
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.


 
Reply With Quote
 
 
 
 
Daniel Crichton
Guest
Posts: n/a
 
      06-14-2007
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


 
Reply With Quote
 
 
 
 
zz12
Guest
Posts: n/a
 
      06-14-2007
That fixed it. You are awesome. Thanks a bunch Daniel. Much appreciated.

Take cares


"Daniel Crichton" <> wrote in message
news:...
> 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
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Location, location, location =?Utf-8?B?VHJhY2V5?= Wireless Networking 2 02-17-2007 08:37 PM
Wireless Network cutting off... =?Utf-8?B?Smlhbw==?= Wireless Networking 2 04-28-2006 01:24 AM
ASP.NET datagrid is cutting off bound text column Dave ASP .Net 1 02-02-2006 12:31 PM
Web site cutting off DLs Lee Davison Computer Support 2 07-26-2004 04:16 AM
WWW cutting off Youyouyou Computer Support 3 01-30-2004 11:06 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57