to g...">

Passing variables in classic ASP

I am dealing with legacy code where there is another ASP page.

<!--#INCLUDE virtual="/PAGE1.ASP"-->

to get a variable, say x, from this page, I believe that I will do:

x = Request.Form("x")

right?

Also, are variable case sensitive for classic .asp files?

Many thanks.

-2
source share
3 answers

You should consider that the page was embedded in one continuous page, so if you include several files .asp, they will make up your completed page.

For example, if you have three files:

File_1.asp

<h1>Hello, World!</h1>

File_2.asp

<p>This file will be included too!</p>

File_3.asp

<%Dim version
version = 1.1%>

... and include them in a single kernel file ...

File_Output.asp

<!-- #include virtual="file_1.asp" -->
<!-- #include virtual="file_2.asp" -->
<!-- #include virtual="file_3.asp" -->
<% Response.Write(version) %>

File_Output.asp version, File_3.asp.

.

- EDIT -

( ):

, ASP. VBScript , JScript (, , JavaScript) .

, Err:

, , , :

On Error Resume Next    '<-- This line starts trapping errors
    ...
On Error Goto 0         '<-- This line stops trapping errors

, . ASP.NET, Java .., , ; Try...Catch, . , . . script, . : Number Err:

On Error Resume Next    '<-- This line starts trapping errors
    'Some database manipulation...
    If Err.Number <> 0 Then
        ... 'Handle the error
    End If
On Error Goto 0         '<-- This line stops trapping errors

, :

On Error Resume Next    '<-- This line starts trapping errors
    'Some database manipulation...
    Select Case Err.Number
        Case 1
            ... 'Handle the error
        Case 2
            ...
        Case 3021 'No data returned
            Response.Write("No data was returned.")
    End Select
On Error Goto 0         '<-- This line stops trapping errors

, .

+6

- <input type="text" value="something" name="x"/> , , request.form(x) , , post

http://www.w3schools.com/asp/asp_inputforms.asp

+2

Assuming that it PAGE1.ASPdeclares a type variable dim foo, this variable is global, and the parent page can access it through foo, for example. foo = "bar".

+2
source

Source: https://habr.com/ru/post/1651331/


All Articles