Jump to content

URLEncode


nscnick

Recommended Posts

I have an access database which is searched through a Frontpage generated asp page SQL query. The problem is that it translates a web address hyperlink with a %2E instead of the period, even though the link itself is displayed on the browser page correctly.Does anybody have any ideas how this can be prevented or modified?This is the asp fragment that takes the access field (called www) containing the url:<td width="90" bgcolor="#CCFFFF" height="18"><!--mstheme--><font face="Arial, Arial, Helvetica"><p style="margin-top: 0; margin-bottom: 0"><font size="2"><b>website:</b></font><!--mstheme--></font></td><td width="547" bgcolor="#FFFFFF" height="18"><!--mstheme--><font face="Arial, Arial, Helvetica"><p style="margin-top: 0; margin-bottom: 0"><font size="2"> <a href="http://<%=FP_FieldURL(fp_rs,"www")%>"><!--webbotbot="DatabaseResultColumn" startspans-columnnames="ID,name,nameinit,title,fname,sname,position,address1,address2,address3,town,postcode,daytel,evetel,mob,fax,email,www,object,objectinit,aims,affiliation,membreq,agegps,charges,venue,times,wheelch,notes,remarks"s-column="www" b-tableformat="FALSE" b-hasHTML="FALSE" clientsidelocal_preview="<font size="-1">&lt;&lt;</font>www<font size="-1">&gt;&gt;</font>"preview="<font size="-1">&lt;&lt;</font>www<font size="-1">&gt;&gt;</font>" --><%=FP_FieldVal(fp_rs,"www")%><!--webbotbot="DatabaseResultColumn" i-CheckSum="7628" endspan --></a></font><!--mstheme--></font></td>The resulting viewable page after the query has run (in the browser) generates through View Source:<td width="547" bgcolor="#FFFFFF" height="18"><!--mstheme--><font face="Arial, Arial, Helvetica"><p style="margin-top: 0; margin-bottom: 0"><font size="2"> <a href="http://www%2Enscdesign%2Ecom">www.nscdesign.com</a></font><!--mstheme--></font></td>The output is a two column table of several fields arranged vertically from a single record. The other fields aren't shown above.I can see the %2E but am unsure how I can prevent this translation. This seems to be a result of what happens from the query output as putting a url directly into html doesn't produce the encoded periods. And the data in the database uses a period. So somewhere among the upper fragment the creation of the hyperlink from the data causes the problem.I wouldn't know where to start trying to work out what the asp fragment is doing.

Link to comment
Share on other sites

I have an access database
Ick.
which is searched through a Frontpage generated asp page SQL query.
Double ick.Before you do anything else, learn to write HTML and ASP by hand. WYSIWYG editors are notorious for creating ugly, bloated code (and code, mind you, that doesn't format correctly in non-IE browsers). And don't use Access if you plan to have more than 5 users connected to your site at any given time, and don't use Frontpage if you plan to do any kind of serious web development.
The problem is that it translates a web address hyperlink with a %2E instead of the period, even though the link itself is displayed on the browser page correctly.Does anybody have any ideas how this can be prevented or modified?This is the asp fragment that takes the access field (called www) containing the url:[snip]I wouldn't know where to start trying to work out what the asp fragment is doing.
Apart from the 90% of useless junk generated by frontpage, nothing is wrong with the fragment you've posted.Two things come to mind:1) Check your database. If the data in your database is URLEncoded, then you have a problem with record input, not record output.2) Check your code. According to your code, you're displaying fields like this:
<a href="http://<%=FP_FieldURL(fp_rs,"www")%>">

The function FP_FieldURL is outputting your data, its the piece of code that's formatting your data incorrectly. Find that function and comment out any line of code that says "someVariable = Response.URLEncode(someVariable)". That will format everything correctly, but just be aware that doing so is a security issue, it leaves you open to XSS attacks.If you don't want to edit your function, then here is a possible solution:The variable fp_rs is most likely a recordset. In that case, you can access your field directly. Try modifying your code to look something like this:

<a href="http://<%=fp_rs("www")%>">

If that doesn't work, you have to edit your functions. If you're still having problems, post the code for function FP_FieldURL, and any other functions called from it.

Link to comment
Share on other sites

I've obviously got some reading to do! The data in the database is correct and not encoded, which doesn't mean that in the process of outputting it hasn't been changed. I can't find any reference to a URLEncode function, so assume that Frontpage is doing it by default.While I acknowledge your 'icks', the apps are used because I have them and don't cost me any extra money, and up to now haven't been a problem as I am reasonably familiar with using them but don't do any code writing except under duress, I'm not a programmer, though can get by after a fashion.Thanks for the help, I may be back soon!

Link to comment
Share on other sites

  • 2 weeks later...

Phew -- sorted it! Many thanks for the pointers.The functions are included in an 'invisible' directory, not accessible from Frontpage. After updating all of them the offending items no longer appear.The lack of real documentation on MS products speaks volumes.Once again thanks for the help.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...