Server.HTMLEncode will not work

Results 1 to 2 of 2

Thread: Server.HTMLEncode will not work

  1. #1
    James McIntosh Guest

    Default Server.HTMLEncode will not work

    I have a page where it grabs records from the "category" column in my database and turns it into a link.<BR><BR>In IE:<BR>Everything is sweet until it encounters ampisans (&)(should code as %26) or quotation marks which it will not code it just leaves the as normal which screws up my response code as it grabs info for displaying its results from the addressbar.<BR><BR>In Netscape:<BR>It does not even bother to recode any of it, it leaves spaces as spaces rather than the %20 which IE converts them to.<BR><BR>I do not wish to go through the DB and rewrite the "&" to "and" <BR><BR>This is an example and the code<BR><BR>Record: <BR>Swing Arms & Fittings<BR><BR>My Code:<BR>&#060;a href="WorkCat.asp?category&#060;%=Server.HTMLEncod e(rsCat.Fields("Category").value)& Chr(34) & "&#062;" & rsCat("Category").Value%&#062;&#060;/a&#062;<BR><BR>Result from Netscape:<BR>http://localhost/WorkCat.asp?category=Swing Arms & Fittings<BR><BR>Result from IE:<BR>http://localhost/WorkCat.asp?category=Swing%20Arms%20&%20Fittings<B R><BR>When I change the spaces and ampisans to is their HTML equivilant the response page works.<BR>http://localhost/WorkCat.asp?category=Swing%20Arms%20%26%20Fittings <BR><BR>How do I make it do this as it appears that me coding Server.HTMLEncode does not work?<BR>

  2. #2
    Join Date
    Dec 1969

    Default For a URL, try Server.URLEncode

    It helps to use the right method.<BR><BR>HTMLEncode is the thing that changes &LT; into &amp;LT; which is not what you want.<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts