简体   繁体   中英

Passing the asp classic html as a string from client-side to server-side

I am having the next scenario (I can't change it). I have an classic asp page. In it, I have the asp code, the javascript code, and the VBscript code. When the user clicks the button confirm, the javascript function "confirm" is executed. In it, the page submits a form to itself.

What I want to accomplish is the next thing. Inside that javascript function confirm, I can easily get the web page html as a string. But what I want is to get that string in the VBScript part when the page processes the self-submit done. I have tried the next things:

  1. Inserting in an asp input hidden control in the page, and load from JavaScript the needed string in that input. Afterwards I expected to get it in VBScript by Request("controlId/controlName") . But it fails me because the input hidden control can't have strings that large.

  2. In the JavaScript confirm function, to load in a session variable in the string. But it looks like I can't write a client-side variable in a session variable.

  3. To store through the JavaScript function a temporary file and passing it through a input file control. This I only have thought about it. Because i don't think that it is a good solution to store a temporary file in the client-side, and I still have the believe to find a better solution than this. Also I don't know exactly how to write files with JavaScript in the client-side.

I remember that I have tried all this, if I remember another thing that I tried, I will post it here.

I have slammed my face repeatedly against the desktop, but I can't find a solution to this. Any idea would be really helpful.

But it fails me because the input hidden control can't have strings that large.

Use method="post" instead of method="get" in the form, and the data size is practically limitless. Ie the limit changes from a few kilobyte to several megabyte.

But it looks like I can't write a client-side variable in a session variable.

That is correct. The session variables only exist on the server side.

To store through the javascript function a temporary file and passing it through a input file control.

That is a process in two steps, where each step in itself is generally impossible. You can't access the local file system using Javascript, and you can't set the file name of an input file control using Javascript.

So you want to get html page in your ASP using javascript?

Why do you want to do that. You can use your a form with a post method to send big string.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM