Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

getting string from server script to Client script

Status
Not open for further replies.

gangar

Programmer
Apr 17, 2008
7
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
 
No, I haven't. I new to ASP and scripting.Could you please provide some example code. - Thanks
 
I tried Html encoding, and having same problem.

I tried with simple \n in the input string:

function DisPlayMsg()
{
var outputstr
outputstr = "<%= Server.HTMLEncode(Response.BinaryWrite(Request.BinaryRead(Request.TotalBytes))) %>"

alert(outputstr)
}

And after server process:

function DisPlayMsg()
{
var outputstr
outputstr = "abcd
efgh"


alert(outputstr)
}


Ann obviously it is erroring out.
 
If the character string contains [tt]\n[/tt] and the output of the ASP looks like this:
[tt]
outputstr = "abcd
efgh
[/tt]

Then the ASP must be written in JavaScript and the [tt]\n[/tt] is being evaluated rather than being sent to the browser... If this is indeed the problem then it should be fixed by replacing "\" with "\\" to *escape* the slash.
 
I was hoping that there is a better way rather than handling myself each and every special character might appear in my input string.

When I tried to launch html form instead of ASP, I can pass input string as dialog arguments from my C++, which handles all special characters perferctly!
Only problem i can see with ASP is passing string with special characters from server script to client script.
 
What about replacing CHR(13),CHR(11),etc. with the slash character equivalents?
 
If you write the server-side ASP in VBScript, the [tt]\n[/tt] will be meaningless...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top