将Classic ASP会话变量转换为内联JavaScript

时间:2016-07-13 16:31:01

标签: javascript vbscript asp-classic session-variables

如何在Classic ASP页面上获取此JavaScript的会话变量?

Literal literalInner = new Literal();
literalInner.Text = "Testing";

Label lblInner = new Label();
lblInner.Attributes.Add("SkinID", "Required");

Label lblOuter = new Label();
lblOuter.ID = "lblPrimary";
lblOuter.Controls.Add(literalInner);
lblOuter.Controls.Add(lblInner);

placeholder.Controls.Add(lblOuter);

1 个答案:

答案 0 :(得分:4)

您需要使用字符串连接字符Session("USERCODE")将会话变量&连接到字符串中,这与其他语言不同,VBScript只是通过将其放在字符串中来推断变量。 / p>

Dim report: report = "<script type=""text/javascript"">window.open(""http://somesite.com/payvoucher.aspx?usercode=" & Session("USERCODE") & """,""_self"");</script>"
Call Response.Write(report)