Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

getting string from server script to Client script

gangargangar Posts: 7Member
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 ",
,
... in my string.

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

Thanks

Comments

  • FlakesFlakes Posts: 642Member
    : 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 ",
    ,
    ...
    : 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 ",
    ,
    ...
    >> in my string.

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

  • gangargangar Posts: 7Member
    : 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.

  • CyGuyCyGuy Posts: 312Member
    : : 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?
    [green]WHAT you;see_is_what=you.get;[/green]
    -Russ aka DangeRuss
  • gangargangar Posts: 7Member
    : :
    : 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?
    : [green]WHAT you;see_is_what=you.get;[/green]
    : -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 [red]POST[/red] 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.


  • CyGuyCyGuy Posts: 312Member
    : : Wouldn't RSS, SQL, or similar make more sense?
    : : [green]WHAT you;see_is_what=you.get;[/green]
    : : -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 [red]POST[/red]
    : 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. [color=Orange]Good Luck[/color]
  • FlakesFlakes Posts: 642Member
    : : 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 ?

  • gangargangar Posts: 7Member
    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.
    [code]<% 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);[/code]
  • FlakesFlakes Posts: 642Member
    This is a test page i made, but can't generate any errors to test.Can you play with this :

    [code]

    binary string.
    ")%>">


    <%
    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




    %>

    var s1="<%=S%>";
    var s2="<%=Unescape(S)%>";
    alert(s1);
    alert(s2);

    [/code]


Sign In or Register to comment.