Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

ASP.NET Forum


You are currently viewing our ASP.NET Forum as a guest. Please register to participate.
Login



Reply
Old 09-29-2006, 07:01 PM ASP Decode
Novice Talker

Posts: 12
Trades: 0
Hi.

I have a webpage that pulls some HTML from an access database. The tags (such as <, >, &...ect) are encoded to &lt;, &gt; ect..., and I need them decoded back so they display properly. I havn't the slightest idea how to do this. Any help?

Thanks.
MIDNIGHTBANDIT9 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 09-29-2006, 08:07 PM Re: ASP Decode
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Code:
replace(strData, "&gt;",">")
replace(strData, "&lt;","<")
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 09-29-2006, 09:55 PM Re: ASP Decode
Novice Talker

Posts: 12
Trades: 0
I get:

Microsoft VBScript compilation (0x800A0414)
Cannot use parentheses when calling a Sub

How can I fix that?

Thanks.
MIDNIGHTBANDIT9 is offline
Reply With Quote
View Public Profile
 
Old 09-30-2006, 06:07 AM Re: ASP Decode
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Set the replace up fully and correctly in the code that displays your data.
I only showed examples of how to use the replace function

If you only have two HTML entities to replace ( &gt; & &lt; ) then use nested replace functions.
Code:
 
response.write replace(replace(strData, "&gt;",">"), "&lt;","<")
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 09-30-2006, 11:09 AM Re: ASP Decode
ADAM Web Design's Avatar
Canadastaninianite

Posts: 5,938
Name: Adam for web page design, not program
Location: Toronto, Ontario, Canada
Trades: 0
The question I have is...why would you want to?

The whole point of HTML encoding tags is to ensure that those who have malicious intentions (e.g. malicious scripting) won't be able to pull those off.

And if they're stored in the database that way, then you've probably at some point had to encode them using Server.HTMLEncode. The easier thing to do is simply to remove that at the point which it's being called. Mind you, you're opening yourself up to some huge security stuff.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
(my blog)


Please login or register to view this content. Registration is FREE
(with proof)
ADAM Web Design is offline
Reply With Quote
View Public Profile Visit ADAM Web Design's homepage!
 
Old 10-01-2006, 09:01 AM Re: ASP Decode
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Don't see it a case of using HTML.Encode.

The page data is stored in the table with the tags stored as &lt:body&gt; (for example) so they will display as that, rather than be seen as HTML code and be parsed correctly by browsers.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?

Last edited by chrishirst; 10-01-2006 at 09:02 AM..
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 10-17-2006, 05:08 AM Re: ASP Decode
Novice Talker

Posts: 6
Trades: 0
Private Function HTMLDecode(byVal encodedstring)
Dim tmp, i
tmp = encodedstring
tmp = Replace( tmp, "&quot;", chr(34) )
tmp = Replace( tmp, "&lt;" , chr(60) )
tmp = Replace( tmp, "&gt;" , chr(62) )
tmp = Replace( tmp, "&amp;" , chr(38) )
tmp = Replace( tmp, "&nbsp;", chr(32) )
For i = 1 to 255
tmp = Replace( tmp, "&#" & i & ";", chr( i ) )
Next
HTMLDecode = tmp
End Function
dumack is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to ASP Decode
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.25455 seconds with 12 queries