Solved

Retrieving Binary data from a database using ASP

Posted on 1998-08-27
4
186 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
  • 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
An enjoyable and seamless user experience can go a long way on an eCommerce site. While a cohesive layout and engaging copy play roles in creating a positive user experience, some sites neglect aspects that seem marginal but in actuality prove very …
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

777 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