Solved

Retrieving Binary data from a database using ASP

Posted on 1998-08-27
4
188 Views
Last Modified: 2013-12-25
I have information stored in a table with the coloumn set to binary data. What I need to know is how to retrieve it and print it on an ASP page. I have tried the response.BinaryWrite with no result. What should I do?
The binary data is URL encoded. Is there any funktion in ASp for URLDecoding?
0
Comment
Question by:MHQ
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 3

Author Comment

by:MHQ
ID: 1854587
I can extract almost all data using a simpe <% = database("text") %> It is still URL encoded though. And, for some reason, I ca'nt retrieve two of the fields.
0
 
LVL 3

Author Comment

by:MHQ
ID: 1854588
Don't bother about the two fields, found THAT error...
0
 
LVL 28

Accepted Solution

by:
sybe earned 70 total points
ID: 1854589
URLDecoding in ASP can be done. The following 2 functions each do the job:

<script language=JavaScript RUNAT=Server>
function JSUrlDecode(str) {
      return unescape(str):
}
</script>


<SCRIPT RUNAT=Server LANGUAGE="VBScript">
Function URLDecode(str)
   strInput = str
   If strInput = null Then strInput = ""
   ' First convert the + to space
   strOutput = REPLACE(strInput, "+", " ")
   ' Then convert the %number to normal code
   strSplit = Split(strOutput, "%")
   If ubound(strSplit) > 0 Then
      i = 0
      strOutput = strSplit(i)
      Do While i < ubound(strSplit)
         HexCode =  "&H" & Left(strSplit(i+1),2)
         Letter = CHR(HexCode)
         strOutput = strOutput & Letter & Right(strSplit(i+1),len(strSplit(i+1))-2)
         i = i + 1
      Loop
   End If
   URLDecode = strOutput
End Function
</SCRIPT>

<%
' Call the functions by:
NewString = URLDecode(OldString)
'or by
NewString = JSUrlDecode(OldString)
%>

By the way, urldecoded data should not be binary, it is normal text, using a minimal set of ASCII values.

0
 
LVL 3

Author Comment

by:MHQ
ID: 1854590
That did the trick. I apreciate the help!
0

Featured Post

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
Today it’s fairly well known that high-performing websites and applications bring in more visitors, higher SEO, and ultimately more sales. By the same token, downtime is disastrous for companies and can lead to major hits on a brand, reputation, an…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question