Active Server Pages

Moderators: None (Apply to moderate this forum)
Number of threads: 1763
Number of posts: 4498

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
getting string from server script to Client script Posted by gangar on 7 May 2008 at 10:39 AM
Hello,

I am posting string data from C++ application, which uses activex webbrowser control, to ASP. The only way i can post this string in binary using safearray.
Anyhow, I am able to successfully read this string in ASP server and assign it to client script varible using following statement.

inputstr = "<%Response.BinaryWrite(Request.BinaryRead(Request.TotalBytes))%>"

The problem is when i have some special characters like ",\r,\n... in my string.

Is there a way to get this string to client sdie, so that i parse it and populate fields.

Thanks
Report
Re: getting string from server script to Client script Posted by Flakes on 8 May 2008 at 2:16 AM
: Hello,
:
: I am posting string data from C++ application, which uses activex
: webbrowser control, to ASP. The only way i can post this string in
: binary using safearray.
: Anyhow, I am able to successfully read this string in ASP server and
: assign it to client script varible using following statement.
:
: inputstr =
: "<%Response.BinaryWrite(Request.BinaryRead(Request.TotalBytes))%>"
:
: The problem is when i have some special characters like ",\r,\n...
: in my string.
:
: Is there a way to get this string to client sdie, so that i parse it
: and populate fields.
:
: Thanks


>>The problem is when i have some special characters like ",\r,\n...
>> in my string.

What happens when there are special characters ? does it error out ?

Report
Re: getting string from server script to Client script Posted by gangar on 8 May 2008 at 6:28 AM
: What happens when there are special characters ? does it error out ?
:
:

Yes, it gives error. Error like "Unexpected end of statement" or "Expecting ;" something like that depends upon special char.

Report
Re: getting string from server script to Client script Posted by CyGuy on 8 May 2008 at 6:33 AM
: : What happens when there are special characters ? does it error out ?
: :
: :
:
: Yes, it gives error. Error like "Unexpected end of statement" or
: "Expecting ;" something like that depends upon special char.
:
:
So, let me get this right...

You are sending some C-string-stream to .NET to be displayed on the web?

Wouldn't RSS, SQL, or similar make more sense?
WHAT you;see_is_what=you.get;
-Russ aka DangeRuss
Report
Re: getting string from server script to Client script Posted by gangar on 8 May 2008 at 7:14 AM
: :
: So, let me get this right...
:
: You are sending some C-string-stream to .NET to be displayed on the
: web?
:
: Wouldn't RSS, SQL, or similar make more sense?
: WHAT you;see_is_what=you.get;
: -Russ aka DangeRuss

I kind of new to ASP. So please pardon me since i didn't get your statement clearly.
I am posting string,which is formatted using XML notation, using safearray of type VT_UI1. This is the only way I can POST data to ASP from my ActiveX control. Other side I was trying to use BinaryRead and BinaryWrite to extract this POST string and assign it to client side variable, where the error is occuring.


Report
Re: getting string from server script to Client script Posted by CyGuy on 8 May 2008 at 4:46 PM
: : Wouldn't RSS, SQL, or similar make more sense?
: : WHAT you;see_is_what=you.get;
: : -Russ aka DangeRuss
:
: I kind of new to ASP. So please pardon me since i didn't get your
: statement clearly.
: I am posting string,which is formatted using XML notation, using
: safearray of type VT_UI1. This is the only way I can POST
: data to ASP from my ActiveX control. Other side I was trying to use
: BinaryRead and BinaryWrite to extract this POST string and assign it
: to client side variable, where the error is occuring.
:
Okay, missing the XML part, I would think that binarywrite would be too complicated to sort out without the standard character set.

link: http://msdn.microsoft .com/en-us/library/bb720756.aspx

Perhaps, .NET, being such a coin phrase, would not be a best bet in your application. My philosophy is simple: as long as you know what to expect, it isn't a problem. The project that you propose, I ponder almost daily. given all the constents involved, this is literaly simple and conceptually difficult. Good Luck
Report
Re: getting string from server script to Client script Posted by Flakes on 8 May 2008 at 10:00 PM
: : What happens when there are special characters ? does it error out ?
: :
: :
:
: Yes, it gives error. Error like "Unexpected end of statement" or
: "Expecting ;" something like that depends upon special char.
:
:


Can you show some code around the line in which the error is occuring ?

Report
Re: getting string from server script to Client script Posted by gangar on 9 May 2008 at 6:31 AM
Our customers design their own ASP forms. I just needed to give them how to retrieve input POSTed string from our application and then parse it. So customers can write their forms in either javascript or vbscript. I need to give examples in both.
Below code is for assigning string to javascript.
<% Dim Binary11
     Binary11 = Request.BinaryRead(Request.TotalBytes)
     Dim I, S
     For I = 1 To LenB(Binary11)
     S = S & Chr(AscB(MidB(Binary11, I, 1)))
     Next
     %>
  var text = "<%= S %>"       
  alert(text);

Report
Re: getting string from server script to Client script Posted by Flakes on 9 May 2008 at 9:36 PM
This is a test page i made, but can't generate any errors to test.Can you play with this :

<form method="post">
<input type="hidden" name="h1" value="<%Response.BinaryWrite StringToMultiByte("My first <br>binary string.\n")%>">
<input type="submit">
</form>
<%
Function StringToMultiByte(S)
  Dim i, MultiByte
  For i=1 To Len(S)
    MultiByte = MultiByte & ChrB(Asc(Mid(S,i,1)))
  Next
  StringToMultiByte = MultiByte
End Function

Dim Binary11
     Binary11 = Request.BinaryRead(Request.TotalBytes)
     Dim I, S
     For I = 1 To LenB(Binary11)
    	 S = S & Chr(AscB(MidB(Binary11, I, 1)))
     Next
	 
	 


%>
<script langauge="javascript">
var s1="<%=S%>";
var s2="<%=Unescape(S)%>";
alert(s1);
alert(s2);
</script>






 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.